我想在地址栏里输入 http://web/cms/user_detail/74/41245/
然后将其重定向到 http://web/cms/user_detail.php?id=74&contents_id=41245
可是RewriteRule没起作用,报404错误Not Found
The requested URL /cms/user_detail/74/41254/ was not found on this server.这是为什么呢?httpd.conf的相关配置如下,请问还缺了什么配置吗?
---------------------------------------------------------------------------LoadModule rewrite_module modules/mod_rewrite.so<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
</Directory><Directory "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all</Directory><VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot D:\webroot
DirectoryIndex index.html index.htm index.php
ServerName web
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/user_detail/([0-9]+)/([0-9]+)/?$
RewriteRule ^(.*)$ /user_detail.php?id=%1&contents_id=%2
</VirtualHost>
然后将其重定向到 http://web/cms/user_detail.php?id=74&contents_id=41245
可是RewriteRule没起作用,报404错误Not Found
The requested URL /cms/user_detail/74/41254/ was not found on this server.这是为什么呢?httpd.conf的相关配置如下,请问还缺了什么配置吗?
---------------------------------------------------------------------------LoadModule rewrite_module modules/mod_rewrite.so<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
</Directory><Directory "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all</Directory><VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot D:\webroot
DirectoryIndex index.html index.htm index.php
ServerName web
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/user_detail/([0-9]+)/([0-9]+)/?$
RewriteRule ^(.*)$ /user_detail.php?id=%1&contents_id=%2
</VirtualHost>
看来是高人啊,拜一个先,我用了cake php请教下路由正则匹配,如何查看,在哪配置?
我用的环境是windows+PHP集成环境CoreAMP.exe
RewriteRule /user_detail/([0-9]+)/([0-9]+)$ /user_detail.php?id=%1&contents_id=%2 [QSA,L]
我routes.php是这样子的:
<?php
$Route->connect('/', array('controller' => 'top', 'action' => 'index'));
$Route->connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
$Route->connect('/tests', array('controller' => 'tests', 'action' => 'index'));
?>要如何修改?
我把hconf文件里的删除了,然后我的.htaccess文件这么写的,还是不行
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} on [NC]
RewriteRule (.*) http://%{SERVER_NAME}%{REQUEST_URI} [R,L]
RewriteRule /user_detail/([0-9]+)/([0-9]+)$ /user_detail.php?id=%1&contents_id=%2 [QSA,L]
</IfModule>
RewriteCond %{HTTPS} on [NC]
RewriteRule (.*) http://%{SERVER_NAME}%{REQUEST_URI} [R,L]
这两句是做啥的,不怕麻烦呀,直接删除就好了,还敢加flag L...
有些问题想请教,麻烦可以留下QQ什么的么
或者相互关注,发私信?