Niahc
Niahc

Reputation: 164

How to do a 301 redirect for a specific page across directories

I am having trouble getting a simple 301 redirect to work in a .htaccess file. I simply need to redirect a single old url to the new page. I've tried many variations but the code seems so simple that I can't think of any ideas as to why its not working. Its an Apache server, and I don't have access to the httpd.conf file. Other .htaccess configurations I have work fine, however I removed everything but the following code:

Options +FollowSymLinks
RewriteEngine On

Redirect 301 /old-directory/old-page.php http://www.example.com/new-page.php

Upvotes: 0

Views: 30

Answers (2)

anubhava
anubhava

Reputation: 786091

Redirect directive is not from mod_rewrite module. Try this in /old-directory/.htaccess:

Options +FollowSymLinks
RewriteEngine On

RewriteRule ^old-page\.php$ http://www.example.com/new-page.php [L,NC,R=301]

Upvotes: 1

uraimo
uraimo

Reputation: 19851

Is the redirect clause really on two lines?

Put everything on one line:

Redirect 301 /old-directory/old-page.php http://www.example.com/new-page.php

Upvotes: 1

Related Questions