Prince Prince - 1 year ago 66
PHP Question

URL rewriting: Change to

I am working with

and I want to change this url
to this
so wrote the following code:

RewriteEngine on
RewriteRule home index.php

When I go to
it works but when I go to
the url does not change to

How can I solve this problem, please ?

Answer Source

Try :

RewriteEngine on
#externally redirect "/index.php" to "/home"
RewriteCond %{THE_REQUEST} /index\.php
RewriteRule ^ /home [L,R]
#internally map "/home" back to "/index.php"
RewriteRule home index.php
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download