Matt Maclennan
Matt Maclennan

Reputation: 1304

Redirect pages in a subfolder to a new page in same subfolder htaccess

I need to redirect several pages to a new page, the easiest way to explain is this...

http://www.example.com/numbers/0800/bronze.html TO http://www.example.com/numbers/0800/bronze-new.html

http://www.example.com/numbers/0845/bronze.html TO http://www.example.com/numbers/0800/bronze-new.html

Any ideas how to do this in one htaccess rule? Thanks!

Upvotes: 1

Views: 49

Answers (1)

anubhava
anubhava

Reputation: 785266

Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_URI} !-new\.html$ [NC]
RewriteRule ^(numbers/.+?)\.html$ /$1-new.html [L,R,NC]

Upvotes: 1

Related Questions