Reputation: 923
I want to remove the extension of file which is in subdirectory i.e. abc.com/subdirectory/file.html
, tried evry possible way with rewrite rule, but nothing seems to work.
Upvotes: 0
Views: 522
Reputation: 6539
This code will work for you.
URL 'domain.com/index.html'
to display as 'domain.com/index'
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html
Upvotes: 0
Reputation: 1717
I think you want something like
http://www.abc.com/subdir/file right?
So you can do it with .htaccess with
## Remove Extension ##
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html
I use it with php and then I simply write www.abc.com/subdire/file
*REMEBER * I don't know if this solution suit all your needs, your question is really general. Please provide some information
Upvotes: 2