开发者

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 ?

  1. User is requesting a url

  2. Server reads the .htaccess file and prepares the right page ( /mywebsite/home/index.html instead of /myw开发者_如何学编程ebsite/index.html )

  3. 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]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜