我越来越mod_rewrite和双斜杠问题 你能帮我吗? # ProxyPass /balancer-manager ! RewriteRule /phoenix/^(.*) http://phoenixstagingappa.scan-shipping.com:8080/phoenix/$1 [P] ProxyPass /phoenix/ balancer://phoenix/ ProxyPassReverse /phoenix/ http://phoenixstagingappa.scan-shipping.com:8080/phoenix RedirectMatch 301 ^(.*) /phoenix/ RedirectMatch 303 ^/phoenix$ /phoenix/
我想使用nginx在每个html的searchstring中设置mode的值。 我写这样的代码: if ( $arg_mode !~ test ){ rewrite ^(?:/(.*)\.html)?$ /$1.html?mode=test? redirect; } 但是会造成其他键值对的丢失。 例如,如果我请求的url http://xxx.xx.xx/weather/bug.html?code=12345&mode=mess 我打算得到 http://xxx.xx.xx/weather/bug.html?code=12345&mode=test 但是我明白了 http://xxx.xx.xx/weather/bug.html?mode=test 代替。 键值对代码= 12345丢失。 我怎样才能解决这个问题?
我使用Ubuntu 15.04,Apache / 2.4.10。 我启用了mod_rewrite和mod_proxy_fcgi。 我的fcgi的apacheconfiguration是: ProxyPassMatch ^/(.+\.(hh|php)(/.*)?)$ fcgi://127.0.0.1:9000/var/www/html/myapp/$1 当我请求http://127.0.0.1/index.php它完美的作品 我添加了这样一个重写规则: RewriteRule ^foo index.php?country=de&handle=cleanmaster&offer=3 现在,当我请求http://127.0.0.1/foo Apache崩溃与此错误: [pid 4242:tid 140535432255360] AH00051: child pid 4539 exit signal Segmentation fault (11), possible coredump in /tmp/apache2-gdb-dump 如果我看看核心转储,这是堆栈跟踪: Program terminated with signal SIGSEGV, Segmentation fault. #0 strlen () at ../sysdeps/x86_64/strlen.S:106 warning: Source file is more recent than executable. 106 movdqu […]
我有conf: location ~ ^/secret(.+) { rewrite ^/secret(.+)$ /phpmyadmin$1; } location /phpmyadmin { root /usr/share/; index index.php index.html index.htm; auth_basic "Auth"; auth_basic_user_file /etc/nginx/pass/.pma; location ~ ^/phpmyadmin/(.+\.php)$ { try_files $uri =404; root /usr/share/; include sites-available/common/php; } internal; } 提交login表单phpmyadmin后,我已被redirect到mysite.com/phpmyadmin/index.php?token=…而不是mysite.com/secret/index.php?token… 为什么这样做?
我正在运行安装了rewrite_module的Apache 2.2.15。 我有如下规则在我的vhost.conf: RewriteRule \n ^/advanced/selector/profiles/([A-Za-z0-9]+)/?$ \n "/advanced/selector/profiles/rewrite.cfm?path=$1" [L] 这应该捕获不存在的path,并将请求redirect到捕获组作为URL.path参数的rewrite.cfm文件(../profiles/文件夹中的唯一文件)。 但是,我目前正在得到一个403错误。 我的服务器访问日志正在logging403,但我的错误日志不是。 devserver.mydomain.co.uk – – – [25/Jan/2016:12:17:47 +0000] "GET /advanced/selector/profiles/FirstYearAllowance HTTP/1.1" 403 95 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36" 如果有我忽略包括的有用信息,很乐意发布更多的细节。 我会很感激,如果有人可以告诉我如何得到这个工作!
我一直试图删除任何/所有的连字符 – 并强调_传入的URL请求到我的nginx服务器。 所以要清楚的是,当有人input一个URL如下: https://www.example.com/my-name_is-tom …我需要nginx重写URL如下: https://www.example.com/mynameistom 我正在使用以下configuration: server { listen 80; return 301 https://$host$request_uri; } server { listen 443 ssl; server_name top.example.com; ssl_certificate /etc/ssl/top.example.com.crt; ssl_certificate_key /etc/ssl/top.example.com.key; # set the root root /srv/top.exemple.com; index index.html; location ~ ^/([a-zA-Z0-9=\?\_\-]+)$ { rewrite ^(/.*)-(.*)$ $1$2 last; rewrite ^(/.*)_(.*)$ $1$2 last; rewrite ^/(.*)$ / break; } location / { […]
我想使现有的PHP网站(Apache)在IIS 8.5下的虚拟文件夹上运行。 在一些不错的在线工具的帮助下,我翻译了下面的.htaccess内容: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> 到web.config: <rule name="rule 1" stopProcessing="true"> <match url="^index\.php$" /> <action type="Rewrite" url="/-" /> </rule> <rule name="rule 2" stopProcessing="true"> <match url="." /> <action type="Rewrite" url="//index.php" /> </rule> 这适用于某些url,如http://www.my_new_website.com/ 。 但是,我的目标是使本网站运行在ASP.NET Web应用程序下的虚拟目录中,例如http://www.my_asp_net_website/php_app/ 。 因此,我在IISpipe理器中创build了一个虚拟目录“php_app”,指向目录C:\ […]
如果这是一个新手问题,我很抱歉 – 我不能相信它的辛苦,所以我必须错过一些东西。 我有一个应用程序在https://example.com/application/* 。 它使用来自https://reference.com/maps/*的PNG 我想要的是,在https://example.com/maps/*的调用下,从reference.com返回相应的PNG,并在可能的情况下顺便caching内容。 我尝试了反向代理: ProxyPass /maps/ https://reference.com/maps/ 现在,如果在我的源文件中有<img src="/maps/PNG1.png">浏览器会显示我https://reference.com/maps.PNG1.png ,但它是浏览器正在执行抓取,不是服务器。 我尝试使用http://httpd.apache.org/docs/2.4/rewrite/proxy.html的示例转发代理: RewriteEngine on RewriteBase "/maps/" RewriteRule "^(.*)$" "https://reference.com/maps/$1" [P] ProxyPassReverse "/maps/" "https://example.com/maps/" 重写日志显示的是 (2) init rewrite engine with requested uri /maps/PNG1.png (1) pass through /maps/PNG1.png 我错过了什么? 有复杂的 – 这是所有的SSL(是的,SSLProxy打开),通过PNG服务器的调用使用客户端身份validation,但我不认为这是相关的。 呵呵,它使用的是IBM HTTP Server,但我认为指令结构和Apache一样。 线索,任何人?
在旧的Apache主机中,我们在public_html/adm有以下.htaccess文件: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /adm/index.php [L] </IfModule> 如果path不存在,这应该将adm /adm/index.php之后的每个urlredirect到/adm/index.php文件。 而且工作得很好。 然后,我把这个网站迁移到了IIS(v8.5),并且使用“Import Rules …”工具,我试图达到同样的效果,但是一开始它和/admpath下的其他网站混淆了。 为了解决这个问题,我改变了原来的.htaccess文件,如下所示: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond adm/%{REQUEST_FILENAME} !-f RewriteCond adm/%{REQUEST_FILENAME} !-d RewriteRule adm/. /adm/index.php [L] </IfModule> 生成的IIS规则如下所示: <rewrite> <rules> <rule name="Imported Rule 1" enabled="true" stopProcessing="true"> <match url="adm/." ignoreCase="false" /> <conditions logicalGrouping="MatchAll"> <add input="adm/{REQUEST_FILENAME}" […]
我试图重写从我的url中删除.php,但迄今没有运气。 这是我到目前为止,然后我的结果下面的这个configuration。 location ~ \.php$ { try_files $uri/ @extensionless-php; include fastcgi_params; fastcgi_pass hhvm; fastcgi_cache_bypass $skip_cache; fastcgi_no_cache $skip_cache; fastcgi_cache ASPS; fastcgi_cache_valid 200 60m; } location @extensionless-php { rewrite ^(.*)$ /$1.php last; } 这导致: example.com/page1.php转到example.com/page1.php并正确渲染example.com/page1渲染index.php example.com/page1/渲染index.php 有没有人遇到过这个? 这似乎是一个非常普遍的事情,但我有几个小时的麻烦,并无休止地在网上search。 谢谢你的帮助!