简体   繁体   English

Mod-rewrite在网络解决方案服务器上不起作用

[英]Mod-rewrite not working on Network Solutions server

I have a website that requires mod-rewrite to function well, but it seems to not be functional on the Network Solutions shared server we're running on. 我有一个网站,需要mod-rewrite才能正常运行,但是在我们运行的Network Solutions共享服务器上似乎无法正常运行。 Network Solutions promises it's installed but won't provide any further support without additional payment. Network Solutions承诺已安装该产品,但如果不支付额外费用将不会提供任何进一步的支持。

I placed a simple test at the following folder which contains two files. 我在以下包含两个文件的文件夹中进行了一个简单的测试。 The first, ".htaccess" contains the following text: 第一个“ .htaccess”包含以下文本:

RewriteEngine On
RewriteRule ^link([^/]*).html$ rewrite.php?link=$1 [L]

The second is the PHP script which tests it, available here: http://www.oceanhousefloridakeys.com/testmr/rewrite.php 第二个是测试它的PHP脚本,可以在这里找到: http : //www.oceanhousefloridakeys.com/testmr/rewrite.php

All I see is that mod-rewrite is installed (no error messages showing) but the rewriteRule is not working. 我所看到的只是安装了mod-rewrite(没有错误消息显示),但是rewriteRule无法正常工作。 Can anybody see why this script isn't working... is there anything I can do to get it running, or is Network Solutions not telling the whole truth? 谁能看到这个脚本为什么不起作用...我能做些什么来使它运行,还是Network Solutions无法说出全部真相?

It looks like your script resides inside a sub-directory. 看来您的脚本位于子目录中。 In that case it's the best solution to set the RewriteBase to the correct path (before any RewriteRule ): 在这种情况下,最好的方法是将RewriteBase设置为正确的路径(在任何RewriteRule之前):

RewriteEngine On
RewriteBase /testmr/
RewriteRule ^link([^/]*).html$ rewrite.php?link=$1 [L]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM