开发者

apache rewriterule

开发者 https://www.devze.com 2023-03-25 08:19 出处:网络
I am quite new to apache rewrite rule. Now I want to redirect the url http://maywedding.0577sz.com/ to

I am quite new to apache rewrite rule. Now I want to redirect the url

http://maywedding.0577sz.com/

to

http://maywedding.0577sz.com/special

My rule now is:

Options +FollowSymlinks
RewriteEngine on
RewriteRule / /special [NC]

But this does not works as I expected. How to write the rule in the .htacce开发者_如何学Goss file?


[NC] has no effect, since your rule only consists of a slash. Instead, you probably want

RewriteEngine on
RewriteRule ^/$ /special/ [R]

to send an HTTP redirect instead of internally rewriting the URL. Don't forget to restart the apache server with apache2ctl restart or /etc/init.d/apache2 restart.


RewriteCond %{HTTP_HOST}   ^(www\.)?danrenjian\.com$
RewriteRule ^/$             http://www.example.com/special [R,L]
0

精彩评论

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