我想将.htaccess重定向example.com
或example.com/
用于example.com/index.php
。
我试过了:
RewriteRule ^/?$ http://www.example.com/index2.php [R=301,L]
但它没有用。
我该怎么做?
答案 0 :(得分:0)
你可以试试这个:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/index\.php/component/quates [NC]
RewriteRule .* index.php/component/quotes [R=301,L]
或阅读此链接:
http://coolestguidesontheplanet.com/redirecting-a-web-folder-directory-to-another-in-htaccess/
答案 1 :(得分:0)
我认为你不需要" /?"介于^和$之间。 ModRewrite将基数视为空匹配,因此搜索只需要" ^ $"。您的规则适用于同一个域。如果你想添加" www"这部分也是一个全新的问题:
RewriteRule ^$ /index2.php [R=301, L]