Mobile app version of vmapp.org
Login or Join
Shakeerah822

: 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

@Shakeerah822

Posted in: #Htaccess #Seo #UrlRewriting

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

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Shakeerah822

2 Comments

Sorted by latest first Latest Oldest Best

 

@Holmes151

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

10% popularity Vote Up Vote Down


 

@Bethany197

You can use javascript redirect on particular pages, If possible in your case.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme