Luqman Marzuki

Luqman Marzuki writes about anything

htaccess URL Rewrite With Old URL on Address Bar

htaccess URL Rewrite With Old URL on Address Bar

You changed your website's url with Apache's URL rewriter, but you need the user's web browser address bar to showing the old url address. There are some ways to do this.

The first one, is by using Flags. You can type in [R] or [R=301] at the end of the rewrite code line. For example:

RewriteRule ^(aboutus)$ aboutme.php [R=301]

Other use of the [R] or [R=301] flags is whenthere are special cases, like,  when your web page address changed and there are still many traffic coming in from the old address. You can't just kill the link, but you can give the browser the correct message by telling that web page has moved temporarily to the URL given. [R] flag is for temporary change of address and [R=301] flag is for permanently been changed.

The second one, is by using the full URL path of the new web page. For example:

RewriteRule ^(aboutus)$

Both of these url rewriting code will make the address bar of the user's browser to show the second url ( when user typed: