Apache redirects if there are no parameters

I tried looking for this solution and apologized in advance if it was there and I missed it.

I am working on setting up a 301 redirect on apache server to point old pages on CMS to new pages. During the transition, we need to manage the pages on both systems. They have a page that:

  • If there are no GET parameters at the end, you need to redirect to the new CMS
  • if it has GET parameters, it should NOT redirect and should continue to work with the old CMS

I've seen a lot of mod_rewrite rules to do the opposite of what I'm looking for, but not one that only gets activated if there are no GET parameters. I tried the following, but it didn't work:

RewriteCond %{REQUEST_URI} ^/page.php$<br />
RewriteCond %{QUERY_STRING} ^<br />
RewriteRule ^.*$ http://new.domain.com [L,R=301]

      

If someone goes to old.domain.com/page.php they should be redirected to new.domain.com. If someone goes to old.domain.com/page.php?var=1&var=2, they should stay on that domain and not be redirected.

Thanks in advance for any help you could provide,
Dave

+3
redirect apache .htaccess mod-rewrite


source to share


No one has answered this question yet

Check out similar questions:

7728
How do I redirect to another web page?
1273
How to handle redirect request after jQuery Ajax call
1192
How do I redirect in PHP?
1182
How can I redirect and add both stdout and stderr to a file with Bash?
710
How do I redirect using Javascript?
2
htaccess mod_rewrite - Trailing Slash and redirect loop
1
Htaccess url redirect works for http not all https
0
.htaccess redirect with unique url and request string
0
301 redirect wordpress? Page_id = xxx
0
Apache redirect url with parameters



All Articles
Loading...
X
Show
Funny
Dev
Pics