2013-04-24 145 views
2

我有一个.htaccess文件,其内容如下阿帕奇国防部重写条件

RewriteEngine on 
# if a directory or a file exists, use it directly 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 

#RewriteCond %{REQUEST_URI} (\/image\/) 
#RewriteRule . image.php 

RewriteRule . index.php 

什么是指示Apache发送请求,如果/图像请求URL中发现/于image.php正确的方法,如果没有,我想index.php处理请求?

回答

1

要处理请求而不提供重定向,只要您的image.php文件配置为处理请求,就可以执行此类操作。如果您发现以“image”开头的字符串加载image.php文件和stop processing the rest of the htaccess file,我们告诉Apache。

RewriteEngine on 
#If we find image, then load image.php 
RewriteRule ^/?image image.php [L] 

# if a directory or a file exists, use it directly 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 

RewriteRule .* index.php 
+0

完美,正是我需要的。谢谢 – 2013-04-24 15:46:32

+0

不客气。 – 2013-04-24 15:47:24

相关问题