jimmy
jimmy

Reputation: 514

mod_rewrite redirect from old server to new

This sounds like a pretty straightforward task, I would like to redirect a url like:

https://oldserver.com/signup/name to https://newserver.com/sign_up/?alias=name

Following the mod_rewrite documentation (here) for this scenario fails.

My .htaccess so far is:

RewriteEngine On
RewriteRule ^/signup/(.+) https://newsite.com/sign_up/?alias=$1 [R,L]

# Catch-all
RewriteRule ^(.*)$ https://newsite.com/$1 [R=301,L]

Can anybody tell me what might be wrong?

EDIT

Adding

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f

before the first rewrite rule still results in a 404

Upvotes: 0

Views: 36

Answers (1)

jimmy
jimmy

Reputation: 514

RewriteRule ^/signup/(.+) https://newsite.com/sign_up/?alias=$1 [R,L]

should be

RewriteRule ^signup/(.+) https://newsite.com/sign_up/?alias=$1 [R,L]

(without the / before signup)

Upvotes: 1

Related Questions