XAMPP中的.htaccess文件无法在Windows 7上运行

XAMPP中的.htaccess文件无法在Windows 7上运行

问题描述:

I have the following URL on my localhost:

http://localhost/?cmd=causeListByCourtName 
http://localhost/?cmd=here could be any other page name

I have tried to rewrite the URL like =

http://localhost/page/causeListByCourtName

I have tried this:

RewriteEngine On
RewriteRule   ^pages/(.+)/?$   .+/?cmd=$1   [NC,L]    
# Handle pages requests

But it do nothing. I am using XAMPP on my windows 7. in my httpd.conf :

LoadModule rewrite_module modules/mod_rewrite.so

is already enabled. What I am doing wrong?

我的localhost上有以下URL: p>

  http  :// localhost /?cmd = causeListByCourtName 
http:// localhost /?cmd =这里可以是任何其他页面名称
  code>  pre> 
 
 

我试图重写URL like = p>

  http:// localhost / page / causeListByCourtName 
  code>  pre> 
 
 

我试过这个: p >

  RewriteEngine On 
RewriteRule ^ pages /(.+)/?$。+ /?cmd = $ 1 [NC,L] 
#处理页面请求
  code>  
 
 

但它什么都不做。 我在我的Windows 7上使用XAMPP。 我的httpd.conf: p>

  LoadModule rewrite_module modules / mod_rewrite.so 
  code>  pre> 
 \  n 

已启用。 我做错了什么? p> div>

You need to also make sure you changed AllowOverride None to AllowOverride All in your httpd.conf file wherever you find it.

Try doing it this way.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^page/(.+)/?$ /?cmd=$1 [NC,L]

Options +FollowSymlinks
RewriteEngine on

RewriteRule ^page/(.*)$ index.php?cmd=$1 [L]

This in case you use index.php as your default page. You can cut down the index.php from the front