簡體   English   中英

XAMPP中的.htaccess文件在Windows 7上不起作用

[英].htaccess file in XAMPP is not working on windows 7

我的本地主機上有以下URL:

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

我試圖重寫網址,例如=

http://localhost/page/causeListByCourtName

我已經試過了:

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

但是它什么也沒做。 我在Windows 7的httpd.conf中使用XAMPP:

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]
Options +FollowSymlinks
RewriteEngine on

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

如果您使用index.php作為默認頁面,則可以使用。 您可以從前面減少index.php

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM