Using Apache to silently redirect requests
I'm actually using php to send a "301 Moved Permanently" header and redirects users to a easy-read address:
www.mywebsite.com
to www.mywebsite.com/home
is there a way to do that with Apache ?
User is requesting a url
Server reads the .htaccess file and prepares the right page (
/mywebsite/home/index.html
instead of/myw开发者_如何学编程ebsite/index.html
)It sends the page and appropriate headers used to warn the browser that the new URL is
www.mywebsite.com/home
(not to use any JavaScript)
With the time and experience growing, I can answer my own question, Hope this will help users that begin with apache :
RewriteEngine on
RewriteRule ^$ /home [R=301,L]
精彩评论