I have directory like this in my site. => aaa.com/p/folder/
How to change url to => aaa.com/folder/
Note: aaa.com/folder/ doesn't exists in my site. I tried this but get error 404 instead.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/p/(.+)$ /$1 [L]
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?aaa.com$
RewriteCond %{REQUEST_URI} !^/folder/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /folder/$1
RewriteCond %{HTTP_HOST} ^(www.)?aaa.com$
RewriteRule ^(/)?$ folder/index.php [L]
Look in your conf file and make sure that AllowOverride is not set to the default of "none". I struggled with this for a while too and the.conf setting was what was causing my biggest headache.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.