Php XAMPP中的.htaccess文件在windows 7上不起作用
我在本地主机上有以下URL:Php XAMPP中的.htaccess文件在windows 7上不起作用,php,.htaccess,redirect,url-rewriting,query-string,Php,.htaccess,Redirect,Url Rewriting,Query String,我在本地主机上有以下URL: http://localhost/?cmd=causeListByCourtName http://localhost/?cmd=here could be any other page name 我试图重写URL,如= http://localhost/page/causeListByCourtName 我试过这个: RewriteEngine On RewriteRule ^pages/(.+)/?$ .+/?cmd=$1 [NC,L]
http://localhost/?cmd=causeListByCourtName
http://localhost/?cmd=here could be any other page name
我试图重写URL,如=
http://localhost/page/causeListByCourtName
我试过这个:
RewriteEngine On
RewriteRule ^pages/(.+)/?$ .+/?cmd=$1 [NC,L]
# Handle pages requests
但它什么也没做。我在Windows7上使用XAMPP。
在我的httpd.conf中:
LoadModule rewrite_module modules/mod_rewrite.so
已启用。我做错了什么?您还需要确保将httpd.conf文件中的
AllowOverride None
更改为AllowOverride All
试着这样做
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^page/(.+)/?$ /?cmd=$1 [NC,L]
您还需要确保将httpd.conf文件中的
AllowOverride None
更改为AllowOverride All
试着这样做
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^page/(.+)/?$ /?cmd=$1 [NC,L]
在这种情况下,您可以使用index.php作为默认页面。您可以从前面减少index.php
在这种情况下,您可以使用index.php作为默认页面。您可以在
重写规则^pages/(.+)/?$.+/?cmd=$1[NC,L]
中从前面减少index.php,将页面更改为另一页。在尝试调试重写时,与往常一样:启用重写日志!否则,你会试图猜测事情为什么不起作用,这是一个笑话。查看优秀的文档,启用日志记录,看看事情是如何工作的。亲爱的塞金,它仍然不起作用。请在重写规则^pages/(.+)/?$.+/?cmd=$1[NC,L]
?尝试调试重写时一如既往:启用重写日志记录!否则,你会试图猜测事情为什么不起作用,这是一个笑话。看看这些优秀的文档,启用日志记录,看看它们是如何工作的。亲爱的塞金,它仍然不工作。如果我需要使用两个或两个以上的参数,即“cmd=pageName&id=34”,我需要添加什么?如果我需要使用两个或两个以上的参数,即“cmd=pageName&id=34”,我需要添加什么?