I'm working on yii framework and trying to remove index.php from url (httpx://localhost:801/index.php/aImages) it should be like this httpx://localhost:801/aImages . So the code given below is in my .htaccess file. This code is working on my localhost but not my team members machine.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
try :
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
and in your config file, use:
...
'urlFormat'=>'path',
'showScriptName'=>false,
...
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
reference : http://www.yiiframework.com/doc/guide/1.1/en/topics.url
You need to create .htaccess file
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\?*$ index.php/$1 [L,QSA]
You can check here for further reference.
Try this rule
RewriteRule ^index\.php/$ $1 [R=301,L]
The last line should be
RewriteRule (.*) index.php/$1 [L]
Go to .htaccess file and add the following lines...
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
Related
I have some directories:
/
/dash
/something
I want to make htaccess to redirect all traffic to it's subfolder index.php , which i did, when i type it works
example.com/dash or example.com/something
But my problem is when i try something like this example.com/dash/login or example.com/dash/another
in this case i'm redirected to / directory
Here is my htaccess in / directory
https:// we.tl/t-NtTDlYKBHr
Options -Indexes -MultiViews +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(?!dash/)(.+)$ /index.php?u=$1 [NC,QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^dash/(.+)$ /dash/index.php?u=$1 [NC,QSA,L]
And in /dash
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?path=$1 [NC,L,QSA]
https:// we.tl/t-lhgQ03tTGE
I am not expert on this. but I think you achieve it by something like this.
put this file in your parent directory
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^none/ none/index.php [NC,L,QSA]
RewriteRule ^dash/ dash/index.php [NC,L,QSA]
RewriteRule ^something/ something/index.php [NC,L,QSA]
RewriteRule ^ index.php [NC,L,QSA]
also if you put htaccess in every directory you may use this in all directories.
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [NC,L,QSA]
Dears,
I want to add / at the end of each url of site, below is what i found online, it works good, but in wp-admin it gives me wp-admin/index.php/index.php/. Like everytime i click on dashboard it will add /index.php/
code from htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1/ [L,R=301]
</IfModule>
Please advise.
Thanks
Keep redirect rule before your default WP rule:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !/$
RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI}/ [L,R=301,NE]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
Make sure to use a new browser for your testing.
I have a link -
http://www.website.com/vendor.php/brand-name
Here brand name is dynamic and this works fine
But now I want to convert this link into
http://www.website.com/vendor/brand-name
when i try to access this - i get No input file specified.
I want to remove .php for only one file in my project - vendor.php
and want to run it as
http://www.website.com/vendor/brand-name
DirectoryIndex index.php
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^vendor/brand-name$ /vendor.php/$1 [L]
RewriteRule ^(.*)$ /vendor.php?tag=$1 [L]
Options -Indexes
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to vendor.php
RewriteRule . vebdor.php
This should work
DirectoryIndex index.php
RewriteEngine on
RewriteBase /
#Rewrite "/vendor/foo" to "vendor.php/foo"
RewriteRule ^vendor/([^/]+)/?$ /vendor.php/$1 [NC,L]
#Rewrite to vendor.php?tag=
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /vendor.php?tag=$1 [L]
Lets say my site structure is like this:
www.mywebsite.com/directory/$variabledirectoryname/$variableproductlink
As you can see in the middle i have 2 variables in the url, but the last is the poduct link. My index.php file stays in www.mywebsite.com/directory/$variabledirectoryname folder. How to load it?
I have this code:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/([^/]+)/?$ index.php [L]
But it doesnt work.. Thanks !
You can use this rule in /directory/.htaccess:
RewriteEngine On
RewriteBase /directory/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/[^/]+/?$ $1/index.php [L]
Update:
You can use this rule in root .htaccess:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(directory/[^/]+)/[^/]+/?$ $1/index.php [L]
I have a project with the following in the .htaccess.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php [L,NC,QSA]
I have two files in a directory test.txt & test.php
I can access /path/to/folder/test.txt but not /path/to/folder/text.php.
What am I missing? This configuration did work before on a different server.
Try this...
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.php [L,NC,QSA]
</IfModule>