开发者

Redirect homepage but not if there are query strings present

开发者 https://www.devze.com 2023-03-01 00:40 出处:网络
I want to开发者_Go百科 redirect just the homepage of a Wordpress site but only if the original URL does not have any query strings on it. This works:

I want to开发者_Go百科 redirect just the homepage of a Wordpress site but only if the original URL does not have any query strings on it. This works:

RedirectMatch 307 ^/$ http://www.consumerenergyreport.com/ticker

...but redirects URLs with queries. I tried:

RewriteCond ! %{QUERY_STRING}

...but that doesn't seem to work with RedirectMatch, only RewriteRule (go fig).

Any ideas? Thanks in advance!


Try this rule in .htaccess file:

Options +FollowSymlinks -MultiViews
RewriteEngine on

RewriteCond %{QUERY_STRING} ^$
RewriteRule ^/?$ /ticker [R=307,L]
0

精彩评论

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