开发者

Redirecting from public_html to public_html/new/

I have Joomla site which was upgraded to newest version. New version is in /new/ folde开发者_运维问答r. How can I instruct apache through the .htaccess file to redirect all requests to /new/ folder instead to public_html?


The best way would be to change the virtual host file and point to the new path.

But if you dont want to change the root path, you can use mod_rewrite to achieve this, using something similar to this in your .htaccess file:

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

It would grab everything after the domain name, and append it after 'new/' Make sure you have the mod_rewrite module enabled.

You can find more information on how to set rules in mod_rewrite here


This is usefull when yuo have more redirects in your .htaccess

Options +FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteRule ^(.*)$ new/$1 [L,R=301]

</IfModule>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜