Redirect old URLs before rewriting them
2 posts
• Page 1 of 1
Redirect old URLs before rewriting them
I have the following code in my .htaccess file and I want to know where I should put permenant redirects and also how they should be written?
I want to redirect http://www.domain.com/en/collection.asp to http://www.domain.com/collection.asp
AND http://www.domain.com/en/available-offspring.asp to http://www.domain.com/for-sale.asp
Many thanks
Simon
I want to redirect http://www.domain.com/en/collection.asp to http://www.domain.com/collection.asp
AND http://www.domain.com/en/available-offspring.asp to http://www.domain.com/for-sale.asp
- Code: Select all
RewriteEngine ON
#RewriteCond %{HTTPS} (on)?
#RewriteCond %{HTTP:Host} ^(?!www\.)(.+)$ [NC]
#RewriteCond %{REQUEST_URI} (.+)
#RewriteRule .? http(?%1s)://www.%2%3 [R=301,L]
RewriteBase /
#News
RewriteCond %{REQUEST_METHOD} !^POST
RewriteCond %{QUERY_STRING} ^Headline=([^=&]+)&ID=([^=&]+)$
RewriteRule ^news\.asp$ news/%1/%2/? [NC,R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^news/([^/]+)/([^/]+)/?$ news.asp?Headline=$1&ID=$2 [NC,L]
Many thanks
Simon
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Redirect old URLs before rewriting them
Hello Simon,
It doesn't matter where to put these particular, try using:
Regards
Andrew
It doesn't matter where to put these particular, try using:
- Code: Select all
# redirect from /en/collection.asp --> /collection.asp
RewriteRule ^en/collection\.asp$ /collection.asp [NC,R=301,L]
#redirect from /en/available-offspring.asp --> /for-sale.asp
RewriteRule ^en/available-offspring\.asp$ /for-sale.asp [NC,R=301,L]
Regards
Andrew
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 8 guests