vincent vincent - 2 months ago 7x
Apache Configuration Question

About Apache Rewrite Function to Shorten URL

I have an URL "" which hosted in Apache server. I would like to shorten the URL to just "" and I managed to do it by using Rewrite function in httpd.conf. However, when I type "" in browser, it will redirect and the URL of the browser will change back to the long url "". What I would like to archive is that when every time I type "" in browser, the browser will open "" but the URL on the browser will still showing "". Below is the currecnt setting:

RewriteEngine On

RewriteRule ^/$ [R,L]

Any ideas?

Thanks in advance.


If you use [R], the Apache will return response code 302 to the browser (with the new Location), which will cause that new URL to appear in address bar.


RewriteEngine On
RewriteRule ^/$ /test/file/index.htm [L]