[英]Rewrite using .htaccess one with index.php other with query string
使用.htaccess,我該如何重寫url,因此在訪問者輸入時:
mydomain.com/
mydomain.com/index.php
mydomain.com/LiveappGame
mydomain.com/game.php?gid=LiveappGame
這僅適用於第二個網址,第一個無效
RewriteEngine on
RewriteRule ^([a-z0-9]+|)/?$ game.php?gid=$1 [QSA,NC]
您只需要DirectoryIndex
指令用於第一個URL,而第二個URL則需要在正則表達式中進行更正。 您可以使用以下代碼:
DirectoryIndex index.php
RewriteEngine on
RewriteRule ^([a-z0-9]+)/?$ game.php?gid=$1 [QSA,NC,L]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.