我想将每个网址重定向到一个php文件,该文件将充当调度程序,根据网址从数据库中提取内容。我不确定这有什么问题。请指点。
<IfModule mod_rewrite.c>
AddDefaultCharset utf-8
rewriteCond %{REQUEST_URI} !(^/admin/)
rewriteCond %{REQUEST_URI} !(\.css$)
rewriteCond %{REQUEST_URI} !(/robots\.txt$)
rewriteCond %{REQUEST_URI} !(\.png$)
rewriteCond %{REQUEST_URI} !(\.jpg$)
rewriteCond %{REQUEST_URI} !(\.jpeg$)
rewriteCond %{REQUEST_URI} !(\.pdf$)
rewriteCond %{REQUEST_URI} !(\.gif$)
rewriteCond %{REQUEST_URI} !(\.GIF$)
rewriteCond %{REQUEST_URI} !(\.xml$)
rewriteCond %{REQUEST_URI} !(\.js$)
rewriteCond %{REQUEST_URI} !(\.ico$)
RewriteRule . pageDispatcher.php [L]
答案 0 :(得分:2)
将您的代码更改为:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule (?!^admin/)^.*$ pageDispatcher.php [L]