: How can I rewrite an old URL using variables to a static html page? I am an htaccess newbee I am trying to redirect the old URLS for my site to the new URLS for my site. The old site
I am an htaccess newbee
I am trying to redirect the old URLS for my site to the new URLS for my site.
The old site used variables in the URL but the new site uses SEO friendly URLs.
When I try to redirect the old URL, it is not w=redirecting and I get the 404 page instead.
I am unsure if the SEO rewrite is the cause of the other rewrite condition failing.
How can I write the RewriteRule so that it redirects the old URL?
Options +FollowSymlinks RewriteEngine On
RewriteCond %{HTTP_HOST} ^WEBADDRESS.co.uk
RewriteRule (.*) www.WEBADDRESS.co.uk/ [R=301,L] RewriteRule ^(.+).html index.php?seo_title= [nc]
redirect 301 /WEBPAGE www.WEBADDRESS.co.uk/WEBPAGE.html
RewriteRule ^http://www.WEBADDRESS.co.uk/test/test.php?c=viewtest&id=56&sat=9&mainsat=1&start=0$ www.WEBADDRESS.co.uk/NEW_URL.html
ErrorDocument 404 /PAGE_NOT_FOUND.html
More posts by @Shakeerah822
2 Comments
Sorted by latest first Latest Oldest Best
The problem I found was that the URL is split between the file and the variables as would be expected.
So everything after the ? is taken as a querystring.
You need to add a condition to check the query string (you can include Regular Expressions)
RewriteCond %{QUERY_STRING} ^viewtest&id=56&sat=9&mainsat=1&start=0$
RewriteRule ^/test/test.php$ www.WEBADDRESS.co.uk/WEBPAGE.html? [R=301,L]
Also notice the ? after the redirected URL, this stops the variables being appended to the new URL
You can use javascript redirect on particular pages, If possible in your case.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.