htaccess不会重写

时间:2013-05-26 13:34:40

标签: php apache .htaccess

我的htaccess有许多重写规则,由于某种原因不会重写/工作:

实施例 上下文:当您进行注册时,单击注册,然后单击提交,将您带到链接:www.sanchexpaycut.com/home

规则:
    RewriteRule ^([a-zA-Z0-9 _-] {3,30})/?$ index.php?page = $ 1 [L]

规则将/应该输出的内容:http://sanchezpaycut.com/index.php?page=home

会发生什么:404找不到错误

错误日志:[Sun May 26 09:10:20 2013] [错误] [客户端24.91.118.174]文件不存在:/var/www/vhosts/patmccoy.me/sanchez/home,referer:{ {3}}

对名称底部的页面也做同样的事情:

链接:http:// sanchezpaycut [dot] com / page_2#listing 规则:     RewriteRule ^([a-zA-Z0-9 _-] {3,30})/?$ index.php?page = $ 1 [L]

会发生什么:http:// sanchezpaycut [dot] com / index.php?page = page_2#listing 会发生什么:404

任何帮助都会很棒,谢谢

服务器信息:mediatemple dv - 已检查并正确安装了mod重写

htaccess文件

RewriteEngine On

DirectoryIndex index.php


RewriteRule ^([a-zA-Z0-9_-]{3,30})/([^/]+)/([^/]+)?$ index.php?page=$1&s=$2&o=$3 [L]

RewriteRule ^([a-zA-Z0-9_-]{3,30})/([^/]+)/([a-zA-Z0-9_]+)/([^/]+)?$ index.php?page=$1&s=$2&o=$3&p=$4 [L]

RewriteRule ^([a-zA-Z0-9_-]{3,30})/([^/]+)/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/([^/]+)?$ index.php?page=$1&s=$2&o=$3&p=$4&q=$5 [L]

RewriteRule ^([a-zA-Z0-9_-]{3,30})/([^/]+)/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/([^/]+)?$ index.php?page=$1&s=$2&o=$3&p=$4&q=$5&r=$6 [L]

RewriteRule ^([a-zA-Z0-9_-]{3,30})/([^/]+)?$ index.php?page=$1&s=$2 [L]

RewriteRule ^([a-zA-Z0-9_-]{3,30})/?$ index.php?page=$1 [L]

RewriteRule ^([a-zA-Z0-9_-]{3,30})?$ index.php?page=$1 [L]

ErrorDocument 404 /404

1 个答案:

答案 0 :(得分:-1)

我从我的网页上举了一个例子。这是我的.htacces文件,它运行良好。

Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -d [OR]    
RewriteCond %{REQUEST_FILENAME} -f 
RewriteRule ^.*$ - [L]

RewriteRule ^desene/categoria-(.*)/(.*)$ index.php?action=selectcategorie&categorie=$1&pag=$2
RewriteRule ^desene/categoria-(.*) index.php?action=selectcategorie&categorie=$1
RewriteRule ^top-desene/categoria-(.*)/(.*)$ index.php?action=top-desene-categoria&categorie=$1&pag=$2
RewriteRule ^top-desene/categoria-(.*) index.php?action=top-desene-categoria&categorie=$1
RewriteRule ^desene/tehnica-(.*)/(.*)$ index.php?action=selecttehnica&tehnica=$1&pag=$2
RewriteRule ^desene/tehnica-(.*) index.php?action=selecttehnica&tehnica=$1
RewriteRule ^top-desene/tehnica-(.*)/(.*)$ index.php?action=top-desene-tehnica&tehnica=$1&pag=$2
RewriteRule ^top-desene/tehnica-(.*) index.php?action=top-desene-tehnica&tehnica=$1
RewriteRule ^contact index.php?action=contact
RewriteRule ^login index.php?action=login
RewriteRule ^desen/(.*)$ index.php?action=desen&iddesen=$1