: Apache HTTP redirect from a URL list One of my web applications will be completely replaced by a new system. All URLs will change and thus external links would break. I want to setup Apache
One of my web applications will be completely replaced by a new system. All URLs will change and thus external links would break. I want to setup Apache httpd to answer with proper 301-redirects to the new URLs.
Now the catch:
There is no formula/regex to derive the new URL from the old, so I need to maintain a mapping list. Ideally I'd like to have it in a location/position where an app I will write allows the content owners to add/edit the mappings themselves. How would I do that?
More posts by @Bryan171
2 Comments
Sorted by latest first Latest Oldest Best
There are several ways to accomplish such redirects:
If you have access to the Apache config files (rather than just to an .htaccess file), you could use mod_rewrite with the RewriteMap directive to load your rewrite mappings from a text file or from a database.
Otherwise, the easiest way may be to use mod_rewrite in an .htaccess file to redirect all the old URLs to a simple script that will look up the appropriate mapping and return the redirect response. (As an alternative to using mod_rewrite, you could also set the script as your 404 error handler, so that it can process any URLs that are not otherwise handled.)
(And yes, you should use 301 redirects for this, not 302.)
You should use 301 redirects which are permanent, 302 are temporary. The search engines will all handle the 301 the same by indexing the new URL.
You can export a txt file sitemap using XML Sitemaps www.xml-sitemaps.com/ put it into excel set your redirects and output the redirects as needed to .htaccess
How many URL's do you have to redirect?
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.