Reputation: 21
This is Code,which is use for removing file extension. I want to remove Directory name as well.what to add in this code. Structure of project= airgle is a index page contains navigation pages.
now,my url is
localhost/demo/airgle/navigation1
i wants localhost/demo/navigation1
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
Upvotes: 1
Views: 151
Reputation: 784898
You can use this rule in /demo/.htaccess
:
RewriteEngine On
RewriteBase /demo/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^((?! airgle/).+?)/?$ airgle/ [L,NC]
Upvotes: 0
Reputation: 53
Hope this code help you,
RewriteEngine On
RewriteCond %{HTTP_HOST} ^localhost/airgle/navigation1/file_name$
RewriteRule ^$ http://localhost/navigation1/file_name [L,R=301]
Upvotes: 1