簡體   English   中英

mod_rewrite重定向而不更改瀏覽器中的URL?

[英]mod_rewrite to redirect without changing the url in the browser?

該站點的一般結構是:

backend
- tralala
- tralala
- www
---- index.php
frontend
- tralala
- tralala
- www
---- index.php
common
- tralala
.htaccess

域名,例如www.mysite.com

我可以在.htaccess進行一些注冊嗎,以便當您訪問www.mysite.com處理的文件frontend/www/index.php然后顯示URL www.mysite.com 如果例如編寫www.mysite.com/admin/處理文件backend/www/index.php

在這種情況下,所有選項都可能是其他選項,例如www.mysite.com/game/gta/ (而不是game/gta/可以是任何東西),在這種情況下,以便標記文件frontend/www/index.php具有以下參數(GET類型)的frontend/www/index.php type=game&name=gta

嘗試在htaccess文件中使用以下規則:

RewriteEngine On

RewriteCond %{REQUEST_URI} ^/admin/
RewriteRule ^ /backend/www/index.php [L]

RewriteCond %{REQUEST_URI} !^/(frontend|backend|common)
RewriteRule ^ /frontend/www/index.php

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM