Question

I have a domain with bluehost.com and not able to get the rewrite rules working properly. Their support is not helpful!

this is what I need. I have the domain "abc.com" and have the files inside "abc.com/v1" so I need

http://abc.com/v1/about-us.php should be written as http://abc.com/v1/about-us

Please advise..With my little knowledge I tried this based on reading some examples..but it doesn't work.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteCond %{REQUEST_URI} !\.(css|gif|ico|jpg|js|png|swf|txt)$

RewriteCond %{HTTP_HOST} !^abc\.com\v1$ [NC]

RewriteRule ^about-us/(.*) about-us.php/$1
Was it helpful?

Solution

Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+/about-us)(/.*|)$ /$1.php$2 [L,NC]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top