我是.htaccess和重写规则的新手 . 如果我的问题不相关,请原谅我 .
我有以下重写规则;
RewriteRule ^\yazarlar$ /writer-list.php [L]
我试图实现,如果有人点击了网址 http://example.com/yazarlar
或 http://example.com/yazarlar/
,他们应该看到 http://example.com/writer-list.php
文件 . 但它不起作用 .
我错过了什么吗?
FULL .htaccess
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond ${REQUEST_URI} ^.+$
RewriteCond %{REQUEST_FILENAME} \.(gif|jpe?g|png|js|css|swf|php|ico|txt|pdf|xml)$ [OR]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -l
RewriteRule ^ - [L]
## If the request is for a valid directory
RewriteCond %{REQUEST_FILENAME} -d [OR]
## If the request is for a valid file
RewriteCond %{REQUEST_FILENAME} -f [OR]
## If the request is for a valid link
RewriteCond %{REQUEST_FILENAME} -l
## don't do anything
RewriteRule ^ - [L]
RewriteRule ^haber/([^/]+)-([^/]+)/?$ article.php?link=$1&i=$2 [L]
RewriteRule ^([^/]+)/([0-9]?)?$ /article-list.php?link=$1&page=$2 [L]
RewriteRule ^([^/]+)?$ /article-list.php?link=$1 [L]
RewriteRule ^\yazarlar$ /writer-list.php [L]
1 回答
无需转义
\y
并删除冗余规则: