背景 我想在我的服务器上用webui设置utorrent。 问题 Utorrentbuild立了自己的networking服务器,默认情况下,它监听端口8080。 然后通过访问example.com:8080/gui访问用户界面 我的目标是有subdomain.server.com使用反向代理。 当我发现有些URL被硬编码为/ gui / *,这当然会破坏事情。 我现在试图从使用mod重写请求中删除该初始/ gui,但由于某种原因,它不工作。 我可以访问该网站(我得到的utorrent加载屏幕),但如果我检查我的日志,我看到/gui/token.html所有请求得到404未find响应,/ /token.html工作得很好,如果我手动尝试虽然。 我已经尝试将重写移动到代理,但也不起作用。 我到目前为止 这是我的虚拟主机文件: <IfModule mod_ssl.c> <VirtualHost *:443> ServerName subdomain.example.com RewriteEngine on RewriteRule ^/gui(/?)(.*)$ /$2 ProxyRequests off ProxyPass / http://127.0.0.1:8080/gui/ ProxyPassReverse / http://127.0.0.1:8080/gui/ RequestHeader set Authorization "Basic YWRtaW46" ErrorLog /var/log/apache2/utorrent-error.log CustomLog /var/log/apache2/utorrent-access.log common SSLEngine on SSLCertificateFile /etc/ssl/certs/*.domain.crt SSLCertificateKeyFile /etc/ssl/private/*.domain.key SSLCACertificateFile /etc/ssl/certs/domain-ca-ssl.crt BrowserMatch […]
我有一个JavaScript Web应用程序调用的REST api。 HTML / CSS和JS文件存储在本地,由Apache提供服务,REST api在远程HTTP服务器上由Apache的ProxyPass指令调用。 这是我实际的httpd.conf文件(开发机器在windows上): <VirtualHost *:80> ServerName myapp.com DocumentRoot C:\myapp <Directory /> Allow from all </Directory> RewriteLog C:\Temp\rewrite.log RewriteLogLevel 0 RewriteEngine On # Let apache serve static files RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f RewriteRule (.*) $1 [L] ProxyPass / http://192.168.0.23:4567/ retry=0 ProxyPassReverse / http://192.168.0.23:4567/ ProxyPreserveHost on </VirtualHost> 我的问题是,远程服务器(192.168.0.23)不支持DELETE和PUT请求(如果我尝试这样做,我得到一个方法不允许的错误)。 不幸的是我没有访问该服务器,但我可以开发它暴露的REST API。 我想要做的是 检查传入的请求是DELETE还是PUT 在请求X-ORIGINAL-REQUEST_METHOD:DELETE上设置HTTP头 […]
我有问题,如果有可能在发生404错误时运行mod_rewrite规则。 例: 要求: http : //domain.com/files/img/file.jpg 如果没有/files/file.jpg ,那么Lightttpd应该重写请求到文件/files2/img/file.jpg 如何在lighttpd / mod_rewriteconfiguration文件中做到这一点?
最近我有一个关于urlencode的奇怪问题,我碰巧在url的pathinfo和querystring部分都有一个“+”。 例如: http://example.com/A + B?s=C + D 我在firefox中使用tamperdata,可以确保thafox firefox已经将url编码为以下内容: http://example.com/A%20+%20B?s=C%20+%20D 而在服务器端,我有Apache的URL重写启用以下指令: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !=/favicon.ico RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] 然后,在PHP中,我得到了以下几点: $_REQUEST['q'] = 'A B'; $_REQUEST['s'] = 'C D'; $_SERVER['QUERY_STRING'] = 'q=A + B&s=C%20+%20D'; 正如我们所知,php会自动使用urldecode来将查询stringparese到$ _REQUEST超级variables,这就解释了为什么'A + B'变成了'AB','C + D'变成了'C D''。 url重写必须解码所有的字符才能进行rewirte映射。 FLAG B将有助于在映射后将其重新映射。所以重写规则变成了跟随着B FLAG的应用。 RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d […]
我有一个网站在一台服务器上工作。 我正在更换主机,所以我在另一台服务器上创build了一个网站进行testing。 一切似乎工作,除了CSS 。 它根本没有加载。 我有777 tmp文件夹和mod re_write启用。 我可以看到除CSS以外的所有caching文件。
我在.htaccess文件中得到了一些mod_rewrite的条件,但是我不认为它的写得很好(我对mod_rewrite还是比较新的) 有时候请求会以无限循环结束 而刚才我把SSL加到文件中.. 当请求https://我得到一个404错误The requested URL /_secure/_secure/ was not found on this server. 不知何故,它增加了一个额外的_secure的path? 的.htaccess # redirect non-active subdomain to 'www' RewriteCond %{HTTP_HOST} !^(admin|api|demo|files|secure|www)\.([^\.]+\.[^\.]+)$ [NC] RewriteRule ^(.*)$ http://www.domain.com [L,R=301] # put 'www' as subdomain if none is given RewriteCond %{HTTP_HOST} ^([^\.]+\.[^\.]+)$ [NC] RewriteRule ^(.*)$ http://www.%1/$1 [L,R=301] # redirect to subdomain RewriteCond %{HTTP_HOST} ^www\.([^\.]+\.[^\.]+)$ [NC] RewriteRule […]
Codeigniter重写查询string,如下所示: http://somedomain.com/index.php?q=something 成为: http://somedomain.com/index.php/q/something 我想在一个(非常)轻巧的网站上模仿这种行为,我正在开发一个婚礼RSVP系统。 我不想要臃肿的代码,也不需要它提供的任何东西。 我唯一想要的就是这个。 不幸的是,我不知道如何设置一个完成这个的mod-rewrite规则。 我可以设置一个规则来将/q/something翻译成?q=something ,但是我不能在没有改变用户正在查看的URL的情况下得到这样的规则。 我基本上是在寻找一些实际上是重写的“无声”版本。 也就是说,我想要重写q/something ?q=something ,但是将用户的URL保留在地址栏中作为q/something 。 提前致谢! 编辑 在该网站的.htaccess文件中,我有以下内容: RewriteEngine on RewriteRule ^/index.php/q/(.*) /index.php?q=$1 在网站的基本configuration(/etc/apache2/sites-available/mysite.conf)中,我有: <VirtualHost *> ServerAdmin [email protected] ServerName www.mysite.com DocumentRoot /var/www/www.mysite.com Options -Indexes +FollowSymLinks </VirtualHost> index.php文件当前只是打印出$_GET['q'] 。 现在,当我访问该网站http://www.mysite.com/index.php?q=12345 ,按预期显示“12345”。 但是,当我导航到http://www.mysite.com/index.php/q/12345 ,它不显示任何东西。 或者,相反,看起来查询string的值是空的。 我不太确定我做错了什么。
我使用Apache 2.2,Windows 7上的mod_rewrite,它正在工作…除了我没有看到任何日志信息。 我将这些行添加到了我的httpd.conf的末尾: RewriteLog "c:\wamp\logs\rewrite.log" RewriteLogLevel 9 日志文件是在Apache启动时创build的(所以这不是一个权限问题),但它仍然是空的。 我以为可能有一个冲突的RewriteLogLevel语句在某处,但我检查,没有。 还有什么可能导致这个? 这可能是由Apache不刷新日志文件? (我通过在httpd.exe命令上点击CTRL-C来closures它…这导致访问日志被刷新到磁盘,但在rewrite.log中仍然没有任何内容) 我的(部分)httpd-vhosts.conf: <VirtualHost *:80> ServerAdmin webmaster@localhost ServerName my.domain.com DocumentRoot c:\wamp\www\folder <Directory c:\wamp\www\folder> Options -Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule . everything-redirects-to-this.php [L] </IfModule> </Directory> </VirtualHost>
问题:使用Mod_rewrite,multiview和Apacheconfiguration 简介:该网站是法语,我有问题与unicode编码和mod_rewrite内的PHP无线多视图 旧服务器没有正确处理utf8(在PHP之间的某处,阿帕奇国防部重写或MySQL) 更新服务器到Ubuntu 11.04,这个过程是破坏性的 在var / www /(该网站主要是2个文件index.php&static.php)中丢失了所有文件 丢失了具体的.Htaccess文件 丢失了MySQL dbs 丢失旧的apache.conf 到目前为止,我做了什么: 什么工作: 设置GNutls for SSL,Listen 443 => port.conf 在一个文件中创build了2个虚拟主机:80和443 => website.conf 使用mod_rewriteredirect实施SSL =>redirect:80至:443 尝试设置utf-8无处不在。设置字符集和整理,db连接,mb_settings,名称utf-8和utf8_unicode_ci,无处不在(php,mysql,apache) 一定要服务文件为UTF-8我启用多视图 改名为index.php.utf8.fr和static.php.utf8.fr 启用多视图后,URL中的多字节口音将起作用 SSL TLS 1.0 什么不工作: 启用多视图后,mod_rewrite仅适用于我的一个重写过程 随着multiview禁用,我松散的访问文档的根目录为“禁止” 与多视图禁用,我松动多字节(单字符重音) Apache默认服务器已满设置。 (我可以安全地删除?) 这些是我的configuration文件到目前为止 :80个Vhost文件(这个工作可以用来强制redirect到https) RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} LanguagePriority fr :443 Vhost文件(GnuTls正在工作) DocumentRoot /var/www/x […]
使用通配符dns / apache / mod-rewrite,我想实现以下function: clientname.clients.company.com – > /home/company.com/clients/clientname 我试过重写规则,比如: RewriteEngine On RewriteCond %{HTTP_HOST} ^([^\.]+)\.clients\.company\.com RewriteCond /home/clients\.company\.com/%1 -d RewriteRule ^(.*) /%1/$1 [L] 他们都没有似乎与* .clients.company.com模型 – 我得到一个无限循环错误。