1

We have a client, where were building a new site. There old system had all articles under:

http://www.domain.com/articles

The new site is

http://www.domain.com/resources/articles

Within the articles section url can be as long as:

http://www.domain.com/resources/articles/category-name/title-of-article

and there is

http://www.domain.com/resources/articles/page/# for the pagination

The new site will have the same url structure of the old articles except for the /resources part.

I need to have all incoming traffic that comes under:

http://www.domain.com/articles redirected to http://www.domain.com/resources/articles however I need to make sure that the category name and the title of the article in the url string are also placed in from the old string that was requested to the new one.

How can I do this using htaccess?

--- EDIT ---

Here is my current htaccess:

RewriteEngine on
RewriteRule (.*) $1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/(.*)/(.*)$ ?cat=$1&title=$2&subtitle=$3 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/(.*)$ ?cat=$1&title=$2 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) ?cat=$1
4

1 回答 1

1

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

RewriteBase /

RewriteRule ^(articles/.*)$  /resources/$1 [L,R=301,NC]
于 2013-06-10T01:57:20.480 回答