1

I want to redirect from an old folder to a new one.

I want to redirect the http://domain.com/old/* urls to http://domain.com/new/*.

I found a question which does exactly that: Redirect folder to another with htaccess

I've tried writing a .htaccess in the document root with only the following code given in the answer to the above question:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteRule ^/old/(.*)$ /new/$1 [L,NC,R=302] 

I've also enabled mod_rewrite in the httpd.conf file. But I still can't get apache to redirect from the old folder to the new folder.

I've also check the apache error logs, and all I get is the following error:

[error] [client x.x.x.x] File does not exist: <documentroot>/old
4

1 回答 1

0

如果您希望将请求的所有内容med_rewrite定向到.oldnew

<Directory />
    Redirect permanent /old /new
</Directory>

permanent您可以根据需要跳过(指定重定向代码)。但是,为了能够使用本地 URL,您需要运行 Apache >= 2.2.6。

于 2013-10-07T08:08:38.273 回答