A
A
Andrey Bazykin2010-10-19 21:12:52
Apache HTTP Server
Andrey Bazykin, 2010-10-19 21:12:52

Keeping old site URLs?

There is a site with a lot of information, *.html format pages. This site needs to be updated, transfer all the information to the database, update the design, make more or less normal CNC, but at the same time keep the old URLs so that there are no 404 errors. I understand this can be done using mod_rewrite or something else? Tell me please. Thanks in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mithgol, 2010-10-19
@Mithgol

This can indeed be done with mod_rewrite. (See the Apache tutorial for details .)
It can indeed be done some other way. For example, with mod_alias .

E
ertaquo, 2010-10-19
@ertaquo

Here is an example .htaccess file how to do it with mod_rewrite:

RewriteEngine On
RewriteBase /

RewriteRule ^old/document.html$ index.php?page=new_document [L]

You can combine multiple documents using regular expressions, like this:
RewriteRule ^old/(\w+).html$ index.php?page=new_$1[L]

[L] means that this redirect will not be further processed by mod_rewrite and will lead directly to index.php.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question