当我在本地主机工作时,我应该如何更改 mod_rewrite url 的根目录
我正在从事网站维护工作。它使用 mod_rewrite 技术。但我对 mod_rewrite 很陌生。我应该如何更改 url 才能在本地主机中正常工作。 这是代码:
# Enable mod_rewrite, start rewrite engine
Options +FollowSymLinks
RewriteEngine on
rewritecond %{http_host} ^electricians4u.com.au [nc]
rewriterule ^(.*)$ http://www.electricians4u.com.au/$1 [r=301,nc]
ErrorDocument 404 /error404.php
# for searching
RewriteRule ^([^/]*)-in-([^/]*)\.htm$ /search.php?searchby=$1&SearchString=$2&search.x=$3&search.y=$4&search=Find+Agent [NC]
# for nav
RewriteRule ^electricians-in-([^/]*)-([^/]*)$ /search.php?SearchString=$1&state=&page=$2 [NC]
# index page
RewriteRule ^find-electrician-(.*)$ /find_electrician_in.php?state=$1 [NC,L]
# find page
RewriteRule ^electrician-(.*)-(.*)$ /find_electrician_in.php?state=$1&bspname=$2 [NC,L]
# find page
RewriteRule ^electricians-in-([^/]*)\.htm$ /search.php?state=$1&bspname=$2&locality=$3 [NC]
请帮忙。我知道要问这个愚蠢的问题。但我不知道其他选择。
I am working on a site maintainence. It uses mod_rewrite technique. But im new to mod_rewrite. How should i change the url to work correctly in my localhost.
here's the code:
# Enable mod_rewrite, start rewrite engine
Options +FollowSymLinks
RewriteEngine on
rewritecond %{http_host} ^electricians4u.com.au [nc]
rewriterule ^(.*)$ http://www.electricians4u.com.au/$1 [r=301,nc]
ErrorDocument 404 /error404.php
# for searching
RewriteRule ^([^/]*)-in-([^/]*)\.htm$ /search.php?searchby=$1&SearchString=$2&search.x=$3&search.y=$4&search=Find+Agent [NC]
# for nav
RewriteRule ^electricians-in-([^/]*)-([^/]*)$ /search.php?SearchString=$1&state=&page=$2 [NC]
# index page
RewriteRule ^find-electrician-(.*)$ /find_electrician_in.php?state=$1 [NC,L]
# find page
RewriteRule ^electrician-(.*)-(.*)$ /find_electrician_in.php?state=$1&bspname=$2 [NC,L]
# find page
RewriteRule ^electricians-in-([^/]*)\.htm$ /search.php?state=$1&bspname=$2&locality=$3 [NC]
Plz help. I know this silly question to ask. But i dont know other alternative.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果其他所有内容都正确配置并且安装了所有文件,我不明白为什么这不起作用。里面没有什么具体的内容。对 .co.au 域的明确引用将不适用。
只需确保您的 Apache 配置中激活了
mod_rewrite
模块即可。I don't see why this shouldn't work, if everything else is correctly configured otherwise, and all the files installed. There is nothing specific in there. The explicit reference to the .co.au domain won't apply.
Just make sure you have the
mod_rewrite
module activated in your Apache configuration.