我无法生成重定向规则我尝试了很多可能的方法,但这些方法无效。 以下是详细信息:
1)当前链接:https://app.abcd.com(以网址显示)
2)重定向到:https://app.abcd.com/index.php/login
3)应重命名为:https://app.abcd.com/login
我尝试过:
RewriteEngine on
RewriteRule (.*) http://https://app.abcd.com/index.php/login/$1 [R=301,L]
没有工作!
任何帮助!
答案 0 :(得分:0)
试试吧。
Options +FollowSymlinks
Options -Indexes
<FilesMatch "\.(tpl|ini|log)">
Order deny,allow
Deny from all
</FilesMatch>
RewriteEngine on
RewriteBase /example/
RewriteCond %{HTTP_HOST} ^example\.com$
RewriteRule ^(.*) index.php/$1 [R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*)/([^?]*) index.php?_cmd_=$1/$2 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*) index.php?_cmd_=$1 [L,QSA]
答案 1 :(得分:0)
<强> htaccess的强>
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
打开 config.php 并执行替换
$config['index_page'] = "index.php"
答案 2 :(得分:0)
.htaccess for codeigniter:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
在config.php中:
变化:
$config['index_page'] = "index.php";
为:
$config['index_page'] = "";
答案 3 :(得分:0)
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
IndexIgnore *
答案 4 :(得分:0)
尝试在.htacces文件中添加:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [L,QSA]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s(.*)/index\.php [NC]
RewriteRule ^ %1 [R=301,L]
答案 5 :(得分:0)
您可以使用:
RewriteEngine on
RewriteRule ^$ /index.php/login [L,R]
这会将您的主页 / 重定向到 /index.php/login
您也可以使用RedirectMatch
完成此操作RedirectMatch 301 ^/$ /index.php/login/