在httpd.conf使用重写在.htaccess而不是别名 [英] Using Rewrite in .htaccess instead of Alias in httpd.conf

查看:218
本文介绍了在httpd.conf使用重写在.htaccess而不是别名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

想设置了我自己编织的服务器共享的主机,显然我不能修改httpd.conf文件,所以我试图找到一个变通使用重写模块和.htaccess。

Trying to setup up my own Weave server on shared host, obviously I cannot modify httpd.conf file so I try to find a work-around using Rewrite module and .htaccess.

根据此文件 https://wiki.mozilla.org/Labs/编织/同步/ 1.1 /设置的https://wiki.mozilla .ORG /实验室/纺织/用户/ 1.0 /设置我创建的的.htaccess

Based on documentation here https://wiki.mozilla.org/Labs/Weave/Sync/1.1/Setup and https://wiki.mozilla.org/Labs/Weave/User/1.0/Setup I created .htaccess

RewriteEngine on
RewriteRule ^1.1(.*) server-sync/1.1/index.php/$1 [L]
RewriteRule ^1.0(.*) server-sync/1.0/index.php/$1 [L]
RewriteRule ^user/1.0(.*) weaveserver-registration/1.0/index.php/$1 [L]
RewriteRule ^user/1(.*) weaveserver-registration/1.0/index.php/$1 [L]

而不是

but I could not get it worked. I always get Please enter a valid server URL when I setup "http://www.mydomain.com/dir/weave" as Sync URL in Firefox 4.

但我无法得到它的工作。我总是得到的请输入有效的服务器URL 的时候我的设置 http://www.mydomain.com/dir/weave 作为同步URL在Firefox 4。

are these Rewrite rules correct? if so I can prob weave-server config settings :/ Directory structure of my hosted scripts:

这些是重写规则是否正确?如果是的话,我可以概率织服务器配置设置:/ 我的主持脚本目录结构:

/home/myname/www/dir/weave/.htaccess /home/myname/www/dir/weave/server-sync > weave server scripts /home/myname/www/dir/weave/weaveserver-registration > weave server user scripts


推荐答案

我不知道怎么请求织文件,但我认为你可以测试这样的:

I did not know how weave requests file, but I think you can test this:

RewriteRule ^1.1(.*) dir/weave/server-sync/1.1/index.php$1 [L]
RewriteRule ^1.0(.*) dir/weaveserver-sync/1.0/index.php$1 [L]
RewriteRule ^user/1.0(.*) dir/weaveweaveserver-registration/1.0/index.php$1 [L]
RewriteRule ^user/1(.*) dir/weaveweaveserver-registration/1.0/index.php$1 [L]

您的基本目录是 / = /家庭/ MYNAME / WWW / 您的规则应该重写请求 /1.0 DIR /编织/服务器同步/ 1.0 / index.php的$ 1 ,其中 $ 1 是什么,在那之后表示 /1.0 请求。 (注意去掉斜线!或者,你可能会增加一倍斜线结束)。

Your base directory being / = /home/myname/www/ your rules should rewrite request to /1.0 to dir/weave/server-sync/1.0/index.php$1 where $1 is anything that stands after /1.0 request. (Note the removed slash ! Or you may end with doubled slashes).

这篇关于在httpd.conf使用重写在.htaccess而不是别名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆