WebFaction
Community site: login faq

I just can't seem to figure out how to 301 redirect an old URL https://www.mydomain.com/old-url/ to https://www.mydomain.com/new-url/

I currently have the following in my htaccess (note the second rule related to this issue):

RewriteEngine On
# SSL redirect
RewriteCond %{HTTP:X-Forwarded-SSL} !on
RewriteRule ^(.*) https://www.mydomain.com$1 [R=301,nc]

RewriteCond %{THE_REQUEST} ^GET\ /old-url/
RewriteRule ^/old-url$ https://www.mydomain.com/new-url [R=301,nc]

# If the root has a querystring with at least 1 character
RewriteCond %{QUERY_STRING} ^.+
RewriteRule ^/?$ https://www.mydomain.com/new-home-page [R=301,nc]

I'm also using Django if that makes a difference. Any help is greatly appreciated.

asked 28 Dec '12, 12:50

aa56280's gravatar image

aa56280
13214
accept rate: 0%


RewriteCond %{REQUEST_URI} old_url/?$
RewriteRule /?$ https://www.mydomain.com/new_url/ [R=301,NC]
permanent link

answered 28 Dec '12, 15:29

aa56280's gravatar image

aa56280
13214
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×220
×27

question asked: 28 Dec '12, 12:50

question was seen: 1,089 times

last updated: 28 Dec '12, 15:29

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2016 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM