[英]How to redirect requests for index.php to /home with htaccess
[英]How to redirect specific FOLDER to index.php
嗨,我有这个网络结构:
/css/
/js/
/img/
/dashboard/
/pages/
/index.php
我得到了这个.htaccess文件
# Setting default charset
AddDefaultCharset utf-8
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /web
RewriteRule ^([\w\-]+)/?$ index.php?page=$1
</IfModule>
正常工作,如果我将myurl / login重定向到index.php?page = login,但我想将此myurl / dashboard重定向到index.php?module = dashboard,将myurl / dashboard / login重定向到index.php?module = dashboard&page =登录
但是不能与我的.htaccess一起使用,您可以帮我吗? 我正在尝试将全部重定向到index.php但无法正常工作,导致将/ img,/ js,/ css文件夹重定向到index.php,我看不到我的网站
提前致谢。
有这种方式:
RewriteEngine On
RewriteBase /web/
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(dashboard)/?$ index.php?module=$1 [L,QSA]
RewriteRule ^(dashboard)/([^/]+)/?$ index.php?module=$1&page=$2 [L,QSA]
RewriteRule ^([\w-]+)/?$ index.php?page=$1 [L,QSA]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.