I have the following code in my .htacess but it didn’t work right. Is it because mod-rewrite is no “on”, if so, how can i check?
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)\$ $1.php [nc]
I wanted to rename my address, example:
http://www.abc.com -> http://www.abc.com
http://abc.com -> http://www.abc.com
http://www.abc.com/123.html -> http://www.abc.com/123
http://www.abc.com/12-12-12.html -> http://www.abc.com/12-12-12
http://subdomain.abc.com/123.html -> http://subdomain.abc.com/123
Basically removing the extension and ensuring that its www is intact.
Edited:
It was rewrote into
Options +FollowSymlinks
RewriteEngine on
RewriteCond % ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
RewriteRule ^(.*).php $1
but still not working
Step 1.
Change all of your links to have the
.htmlremoved from links. Make sure you haveMultiviewsturned off:Step 2.
You need rules to redirect the browser when there is a www missing from the hostname:
Step 3.
You need rules to redirect the browser when a URL is requested with
.htmlor.phpwith the extensions removed:Step 4.
You need rules to internally rewrite the URI if the request was actually for a php or html file:
.htaccess
So all in all, you should have these rules in your htaccess (ditch any rules you may already have trying to solve this issue):
So altogether:
index.phpif that exists). Address bar remains unchanged./images/image.png. Address bar remains unchanged.