I’m setting up some “work in progress” page redirects. One for the whole site “wip-site” and another for just a page “wip-page”.
I want to set it up so people can’t go on the wip pages when they are not supposed to, or they are not being used.
This is done with a query string, if it’s present they see the page, if not they are sent to the homepage. But I don’t want them to see the query string, so I have a redirect to remove it, only that is not working.
Here are two rules:-
RewriteCond %{QUERY_STRING} !iswip
RewriteRule ^wip-(site|page) http://www.example.com/? [NC,L]
RewriteCond %{QUERY_STRING} ^iswip$
RewriteRule ^wip-(site|page)$ /wip-$1/? [R=301,NC,L]
The first one sends you to the homepage if the query iswip
is not present, so: http://www.example.com/wip-page
will send you to the homepage: http://www.example.com
That works.
In the second rule, if the query iswip
is present, as in http://www.example.com/wip-site/?iswip
then you get sent to the page, but without the query.
But that’s not working, the query remains.
I thought the ?
on the end should remove it.
Anyone know what’s wrong?