apache rewriterule
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]
精彩评论