[英]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.