troubleshooting Question

Apache Mod Rewrite with .htaccess redirecting site from old structure to new...

Avatar of dealclickcouk
dealclickcouk asked on
Apache Web ServerWeb Servers
3 Comments1 Solution271 ViewsLast Modified:

I have an existing site that has many indexed pages, the site structure is going to change with the next software update and so I want to do 301 (??) permanent redirect so that old links are redirected to the new structure.

URL's on old site are like:

domain.com/dept/kw.php
domain.com/cat/kw.php
domain.com/subcat/kw.php

The new structure is:

domain.com/dept/kw.html
domain.com/dept/cat/kw.html
domain.com/dept/cat/subcat/kw.html


The new site has an existing .htaccess file that redirects all to a index.php to process:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]


What I'm not sure is, how do I within the same .htaccess get old links to redirect to new link structure permanantly and then with new structure redirect into the index.php ?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros