1

我想将每个 url 重定向到一个 php 文件,该文件将充当调度程序,该调度程序将根据 url 从数据库中提取内容。我不确定这有什么问题。请任何指点。

<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]  

4

1 回答 1

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] 
于 2012-10-25T09:54:10.473 回答