.htaccess 需要更正htaccess以限制某些文件夹

.htaccess 需要更正htaccess以限制某些文件夹,.htaccess,.htaccess,我在我的项目中使用以下htaccess代码 Options +FollowSymLinks -MultiViews RewriteEngine on RewriteBase /apnaujjain #redirect localhost/apnaujjain/page.php?page_id=1&album_id=1&action=contacts to localhost/apnaujjain/1/1/contacts.html RewriteCond %{THE_REQU

我在我的项目中使用以下htaccess代码

Options +FollowSymLinks -MultiViews
RewriteEngine on
RewriteBase /apnaujjain

#redirect localhost/apnaujjain/page.php?page_id=1&album_id=1&action=contacts to localhost/apnaujjain/1/1/contacts.html

RewriteCond %{THE_REQUEST} \s/+.+?\.php\?page_id=([^\s&]+)&album_id=([^\s&]+)&action=([^\s&]+) [NC]
RewriteRule . %1/%2/%3.html? [R=301,L]
RewriteRule ^([^/]+)/([^/]+)/([^./]+)\.html$ page.php?page_id=$1&album_id=$2&action=$3 [NC,L,QSA]

#redirect localhost/apnaujjain/page.php?page_id=1&action=contacts to localhost/apnaujjain/1/contacts.html

RewriteCond %{THE_REQUEST} \s/+.+?\.php\?page_id=([^\s&]+)&action=([^\s&]+)\s [NC]
RewriteRule . %1/%2.html? [R=301,L]
RewriteRule ^([^/]+)/([^./]+)\.html$ page.php?page_id=$1&action=$2 [NC,L,QSA]

#redirect localhost/apnaujjain/contacts.php to localhost/apnaujjain/contacts.html

RewriteCond %{THE_REQUEST} \s/+(.+?)\.php\s [NC]
RewriteRule !^admin/ /%1.html [NC,R=302,L,NE]
RewriteRule ^(.+?)\.html$ $1.php [L,NC]

#RewriteCond %{THE_REQUEST} \s/+(.+?)\.php\s [NC]
#RewriteRule ^ /%1.html [R=302,L,NE]
#RewriteRule ^(.+?)\.html$ $1.php [L,NC]
现在一切都很好,除了一件事,我有一些Web服务,我也从Web服务文件夹调用,url是

http://localhost/apnaujjain/webservice/gethomepagecontent1.php

现在的问题是由于htaccess我的web服务停止工作,它重定向到错误的页面,所以它不工作。我不想在webservice文件夹上应用htaccess规则。请提供帮助,提前感谢。

就在下面的
RewriteBase/apnaujjain
行添加此行:

RewriteEngine On
RewriteBase /apnaujjain/

# add everything for webservice/...
RewriteRule ^webservice(/.*)?$ - [L,NC]

# rest of your existing rules

感谢它现在的工作,但还有一个问题,在未来,我们将在这个网站上有博客,所以它的url将是一样的,我还需要更改这些html格式的url,这样规则将是相同的或将改变,请引导我相信上述规则应该仍然有效,只要
/blog.php
有相同的查询参数。你好,Anubhava,请研究这个问题,因为你告诉我,同样的规则将适用于blog.php页面,但它不起作用,请帮助。。。