【发布时间】:2018-05-28 20:25:26
【问题描述】:
我有一个具有以下路径的 cms:cms/administrator/index.php
我在我的网站 url 后只输入 /cms 时,已将以下行重定向到此。
#CMS rewrite
RewriteRule ^cms/$ /cms/administrator/index.php [L]
但是这一行不会重写到我的 cms 文件夹中的索引文件,它会重定向到 catlisting.php 后面添加几行的行:
RewriteRule ^([\w-]+)/?$ catlisting.php?alias=$1 [QSA,L]
为什么在输入时使用这个规则:website.nl/cms?
这是我的整个 htaccess 文件:
DirectoryIndex
RewriteEngine on
RewriteBase /
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]
#Indexes uitzetten
Options -Indexes
#Cross site access toestaan
Header set Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Headers "origin, x-requested-with, content-type"
#Sitename
DirectoryIndex index.php
#CMS rewrite
RewriteRule ^cms/$ /cms/administrator/index.php [L]
RewriteRule ^home index.php [QSA,L]
RewriteRule ^overzicht shopping-cart-page.php [QSA,L]
RewriteRule ^bestellen checkout.php [QSA,L]
RewriteRule ^contact contact.php [QSA,L]
RewriteRule ^vragen vragen.php [QSA,L]
RewriteRule ^status success.php [QSA,L]
RewriteRule ^voorwaarden voorwaard.php [QSA,L]
RewriteRule ^info/(.*).html contentlisting.php?alias=$1 [QSA,L]
RewriteRule ^verhuur/(.*)/ lp.php?alias=$1 [QSA,L]
RewriteRule ^(.*).html content.php?alias=$1 [QSA,L]
#Zorg ervoor dat onderstaande regels alleen worden uitgevoerd als het geen folder (d) is of een file (f)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#LP
RewriteRule ^c-[^/]+/(.+)$ /verhuur/$1 [L,R=301]
#Shop
RewriteRule ^([\w-]+)/([\w-]+)/?$ product-page.php?cat=$1&alias=$2 [QSA,L]
RewriteRule ^([\w-]+)/?$ catlisting.php?alias=$1 [QSA,L]
#ErrorPages
ErrorDocument 404 /error/404.php
ErrorDocument 403 /error/403.php
ErrorDocument 500 /error/500.php
ErrorDocument 501 /error/501.php
ErrorDocument 503 /error/503.php
ErrorDocument 504 /error/504.php
【问题讨论】:
标签: .htaccess mod-rewrite server url-rewriting