[英]URL Rewrite/Mod Rewrite .htaccess on Apache and PHP
我的網站上只有一個入口點
mysite.com/admin/index.php? View=List&Model=User
通過此index.php文件對數據庫/應用程序的所有訪問。
我想清除上面顯示的URL。
mysite.com/admin/ List/User
想法是刪除鍵“模型和視圖”。
我發現此鏈接看起來非常相似。
在htaccess文件中插入以下代碼:
RewriteEngine On
RewriteRule ^admin/([^/]*)/([^/]*)$ /admin/index.php?View=$1&Model=$2 [L]
重寫的URL:
http://mysite.com/admin/List/User
該站點對於生成重寫URL非常有用
如果還沒有以下內容,請在您的Web根目錄中創建一個名為.htaccess的文件:
# Turn the rewrite engine on (skip this if already done)
RewriteEngine On
# Redirect admin/List/User/ to admin/index.php?View=List&Model=User
RewriteRule ^admin/([^/.]+)/([^/.]+)/?$ admin/index.php?View=$1&Model=$2 [L]
這可能起作用:
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^admin/([^/]+)/([^/]+) /index.php?View=$1&Model=$2 [NC]
添加到您網站的根文件夾中的.htaccess。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.