开发者

Using Apache to silently redirect requests

开发者 https://www.devze.com 2023-03-29 17:46 出处:网络
I\'m actually using php to send a \"301 Moved Permanently\" header and redirects users to a easy-read address:

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

精彩评论

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