簡體   English   中英

htaccess引發500內部錯誤

[英]htaccess throws 500 Internal error

我有一個帶有子目錄XYZindex.php文件的目錄結構。 XYZ包含用於css,圖像,js等的其他子目錄。我正在嘗試完成以下任務:

  1. gallery,img,css,js路徑應映射到同名的XYZ子目錄
  2. 每個單獨的網址(例如http://example.com/my-page都應映射到http://example.com/xyz?route=my-page

以下是我的.htaccess文件,請提供幫助。

RewriteEngine on
RewriteRule ^((?:gallery|img|css|js).*)$ xyz/$1
RewriteRule ^(.*)$ /xyz/?route=$1 [QSA,L]

有這種方式:

RewriteEngine on

RewriteRule ^(?:gallery|img|css|js)/.*$ xyz/$0 [L,NC]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ xyz/?route=$1 [QSA,L]

暫無
暫無

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

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