Hello and thanks to all who contribute to this seemingly mind boggling puzzle. I apologize in advance if .htaccess questions belong on server fault.
So I have to move a domain to our hosting servers, this domain will be redirected to another existing website. We need to redirect the individual pages to their respective pages on the existing website for user friendliness and SEO purposes. The URL pattern of the website being redirected are:
domain.com/index.php?/Page.html
I have found a lot of information in regards to redirecting strings with question marks, but none seem to work and I believe it's because of the /
after the ?
.
The following is the last RewriteRule
I've tried:
RewriteCond %{REQUEST_URI} ^/index.php$
RewriteCond %{QUERY_STRING} ^/(.*).html$
RewriteRule ^(.*)$ http://www.domain.com/index/%1.html [R=301,L]
If I go to domain.com/index.php?/News.html
the RewriteRule
above results in the following:
domain.com/index/News.html?/News.html
I've also previously tried a rewrite from Drupal's site dealing with their nodes queries, but edited for the site I'm working on:
RewriteCond %{QUERY_STRING} ^/(.+)$
RewriteRule ^(.*)$ http://www.domain.com/index.php?/%1 [R=301,L]
RewriteRule ^/*(.*)$ http://www.domain.com/index/$1 [R=301,L]
The above results in a redirect loop. If I can at least get the URL to rewrite to a path with no question marks, I could then do individual redirects for the pages of the site.
Any help in getting rid of the question mark in this situation would be extremely appreciated.
EDIT:
Ultimately, I will be redirecting from one website to another. The websites don't have the same naming conventions, so I imagine I'll use redirect 301 path new URL for the individual pages.
An example of the start to finish, I would need to redirect the following URL:
http://www.domain.com/index.php?/About.html
to:
http://www.newsite.com/about.html
Not all of the old site names will be the same as you see About.html
matching about.html
, there will be URLs with News.html
going to /Blog-Folder/
.
What I imagine would be most efficient is getting the /index.php?/Page.html
redirected to a folder path on the initial website so that it is set up like:
domain.com/index.php?/About.html -> domain.com/index/About.html -> newsite.com/about.html
Feel free to ask for more clarification if needed, I greatly appreciate any and all help.