[英].htaccess - Rewrite with 3 variables but after that get the rest of the URL
[英]Url rewrite from .htaccess with Get variables
我正在使用PHP開發項目,未在使用MVC,而是保留了一個index.php
文件,該文件會根據$_GET['module']
更改其內容
我目前的網址格式是
http://phpquiz.com/school/index.php?module=user_groups&mid=13&cmid=32
現在我想將其更改為
http://phpquiz.com/school/index/user_groups/13/32
我使用了以下腳本,並且能夠重寫url,但是我的網站由於丟失了get變量而停止工作。
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/school/index.php [NC]
RewriteCond %{QUERY_STRING} ^module=(.*)&mid=(.*)&cmid=(.*)
RewriteRule (.*) http://phpquiz.com/school/%1/%2/%3.asp? [R=301,L]
我如何通過保持獲取發票來做到這一點。
嘗試這個:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/school/index.php [NC]
RewriteCond %{QUERY_STRING} ^module=([^&]+)&mid=([^&]+)&cmid=([^&]+)
RewriteRule ^ http://local.htaccess/school/index.php/%1/%2/%3.asp? [R=301,L]
您似乎在做反向。 有以下規則:
RewriteEngine On
RewriteRule ^school/index\.php/([^/]+)/([^/]+)/([^/]+)\.asp$ /school/index.php?module=$1&mid=$2&cmid=$3 [NC,QSA,L]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.