2012-07-20 59 views
0

所以這是到目前爲止我的.htaccess:如何解決我的.htaccess

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti* 

<Limit GET POST> 
order deny,allow 
deny from all 
allow from all 
</Limit> 
<Limit PUT DELETE> 
order deny,allow 
deny from all 
</Limit> 
AuthName site.com 
#Redirect 301/http://www.google.com/ 

Options +FollowSymlinks 
RewriteEngine On 
RewriteRule ^([^/\.]+)/?$ /index.php?page=$1 [L] 

RewriteCond %{HTTP_HOST} ^site.com 
RewriteRule (.*) http://www.site.com/$1 [R=301,L] 

ErrorDocument 404 /404.html 

我所試圖做的是以下幾點:?

index.php頁面= pagesite - >網站.COM/pagesite

但如果我去site.com/images它不進入/圖像它去的index.php?頁=圖像

我該如何解決呢?

另外,如果「pagesite」不在/ includes/pages /中,它是否會重定向到404?

感謝

回答

0

我假設你想而不是直接返回的PHP返回的圖像和其他純文本文件:

RewriteEngine On 
# If the file exists, return it directly 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^(.*)$ /index.php?page=$1 [L] 

This is my typical setup

至於404,由於其他一切都轉到index.php,它應該由您的PHP代碼返回。