I don't have much experience with htaccess rules, some of them are working but when I add a new rule or remove one, how do I test them?? I cannot test it on the actual server. Even in my localhost, I won't be able to test some like https rules, www and other stuff.
我对htaccess规则没有多少经验,其中一些是有效的但是当我添加一个新规则或删除一个规则时,我该如何测试它们?我无法在实际的服务器上测试它。即使在我的localhost中,我也无法测试一些像https规则,www和其他东西。
I can test the rest of url patterns but when I add the www and https rules along with the tested ones on the live server, it gives an error and then I continue testing them on the live server.
我可以测试其余的url模式但是当我在实时服务器上添加www和https规则以及测试的规则时,它会出错,然后我继续在实时服务器上测试它们。
Is there a way to test them without using the actual server and not create another server for testing those rules. Something like a htaccess rule checker or something!?
有没有办法在不使用实际服务器的情况下测试它们,而不是创建另一个服务器来测试这些规则。像htaccess规则检查器之类的东西!?
1 个解决方案
#1
2
There are a few web based testers available to use, unfortunately, these don't always understand all the syntax to accurately check how it works on a real site.
有一些基于Web的测试人员可以使用,遗憾的是,这些测试人员并不总是能够理解所有语法,以准确地检查它在真实站点上的工作方式。
One web based one I like to use is this online tester from Made with Love; http://htaccess.madewithlove.be/
我喜欢使用的一个基于Web的网络测试者来自Made with Love; http://htaccess.madewithlove.be/
It doesn't understand a few items such as %{REQUEST_FILENAME} but for general testing I think it should do the job for you. You copy your code into the box, and you can also submit a url to see what it will rewrite to. If you just want to check syntax errors there are a few web tools available as well.
它不理解%{REQUEST_FILENAME}等一些项目,但对于一般测试,我认为它应该为您完成这项工作。您将代码复制到框中,您还可以提交URL以查看它将重写的内容。如果您只想检查语法错误,也可以使用一些Web工具。
Using web based tools are great for an overall check, but you can't really be sure how it affects a real site until you upload it either to a dev version of the real thing.
使用基于Web的工具非常适合进行全面检查,但在将其上传到真实版本的开发版本之前,您无法确定它对真实网站的影响。
Just recently I've edited a htaccess file, which showed no syntax errors and worked as expected on the tester, which did not work at all on the real site. Site settings may have an impact and all other things which will not show on a web tool.
就在最近,我编辑了一个htaccess文件,该文件没有显示语法错误,并且在测试器上按预期工作,这在真实站点上根本不起作用。网站设置可能会产生影响以及所有其他不会在网络工具上显示的内容。
#1
2
There are a few web based testers available to use, unfortunately, these don't always understand all the syntax to accurately check how it works on a real site.
有一些基于Web的测试人员可以使用,遗憾的是,这些测试人员并不总是能够理解所有语法,以准确地检查它在真实站点上的工作方式。
One web based one I like to use is this online tester from Made with Love; http://htaccess.madewithlove.be/
我喜欢使用的一个基于Web的网络测试者来自Made with Love; http://htaccess.madewithlove.be/
It doesn't understand a few items such as %{REQUEST_FILENAME} but for general testing I think it should do the job for you. You copy your code into the box, and you can also submit a url to see what it will rewrite to. If you just want to check syntax errors there are a few web tools available as well.
它不理解%{REQUEST_FILENAME}等一些项目,但对于一般测试,我认为它应该为您完成这项工作。您将代码复制到框中,您还可以提交URL以查看它将重写的内容。如果您只想检查语法错误,也可以使用一些Web工具。
Using web based tools are great for an overall check, but you can't really be sure how it affects a real site until you upload it either to a dev version of the real thing.
使用基于Web的工具非常适合进行全面检查,但在将其上传到真实版本的开发版本之前,您无法确定它对真实网站的影响。
Just recently I've edited a htaccess file, which showed no syntax errors and worked as expected on the tester, which did not work at all on the real site. Site settings may have an impact and all other things which will not show on a web tool.
就在最近,我编辑了一个htaccess文件,该文件没有显示语法错误,并且在测试器上按预期工作,这在真实站点上根本不起作用。网站设置可能会产生影响以及所有其他不会在网络工具上显示的内容。