我正在使用nginx web服务器为我的wordpress网站。 我将使它成为移动服务的放大版本。 我想添加/放大/我的url。 我也使用漂亮的固定链接为我目前的url,所以我可以知道如何重写我的url在手机版/放大器/ 我正在使用重写^ http://example.com $ request_uri / amp / break; 但是当我服务networking时,它变成了这个 exmaple.com/homepage//amp//amp//amp//amp//amp//amp//amp//amp//amp//amp//amp//amp//amp//amp//amp//amp//amp//amp//amp//amp//amp/ 我希望当iphone服务的网页,链接将是http://exmaple.com/homepage/amp/ 主要目的我只想添加/放大/网站的任何链接。 这是我的nginx.conf server { listen 80; server_name example.com; charset utf-8; access_log logs/xxx.access.log; root /var/www/html; index index.php; location / { try_files $uri $uri/ /index.php?q=$uri; } location /en { try_files $uri $uri/ /en/index.php?q=$uri; } location /my { try_files $uri $uri/ /my/index.php?q=$uri; […]
我的网站是非www ,它在子目录中有wordpress,在根目录和其他子目录中有一些静态的网页 我想从根目录中的网页和其他静态网页子目录中删除.html扩展。 最后加斜线。 301使用斜杠从非斜杠redirect到url。 所以应该是 /articles.html 到 / articles / 和 /subdirectory/book.html 到 /子目录/ book / 下面的代码 最后用非斜线工作 使用斜杠将301redirect到非 这是我的.htaccess <IfModule mod_rewrite.c> Options +FollowSymLinks -MultiViews RewriteEngine On RewriteBase / #removing trailing slash RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)/$ $1 [R=301,L] #www to non RewriteCond %{HTTP_HOST} ^www\.(([a-z0-9_]+\.)?domain\.com)$ [NC] RewriteRule .? http://%1%{REQUEST_URI} [R=301,L] #html RewriteCond %{REQUEST_FILENAME} !-f […]
我正在使用301redirect到Nginx,将我的网站用户redirect到网站的HTTPS版本。 我使用Google的PageSpeedtesting了我的网站,发现我是从主页面redirect的。 这是因为我的CMS。 例: http:// domain.tld – > NGINX 301 – > https:// domain.tld – > CMSredirect – > https:// domain.tld / homepage 我希望能用NGINXredirect直接根连接 location = / { return 301 https:// domain.tld/homepage; } 这适用于主页,但是,这将给404任何其他http页面的错误比主页,我试图添加return 301 https://$host$request_uri; 在位置块,但不知何故这覆盖了根域的规则。 (这再次提供了一个双redirect)有没有办法redirect所有链接与他们相应的request_uri,除了根域? PS我希望没有iffunction做到这一点:请参阅: https : //www.nginx.com/resources/wiki/start/topics/depth/ifisevil/ 这里是我的完整configuration文件的示例: server { listen 80; server_name domainname.tld; location = / { return 301 […]
我正在尝试为WordPress / Woocommerce网站重写以下内容: /product_category/example-category/ /product/example-product/ 至… /example-category/ /example-product/ 使用以下规则: server { listen 10.99.0.3:8080; server_name www.example.com; root /home/www.example.com/public_html; index index.html index.htm index.php; rewrite ^/product-category/1$ /; rewrite ^/product/1$ /; include conf.d/whitelisted.conf; include conf.d/wp/restrictions.conf; include conf.d/wp/wordpress.conf; } …这是从一个单独的文件包含的wordpress.conf规则: location / { try_files $uri $uri/ /index.php?$args; } rewrite /wp-admin$ $scheme://$host$uri/ permanent; location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ { access_log off; log_not_found off; […]
两分钟的IIS从www.exaple.comredirect到www.example.com 。 没人修理它 – 这是一个暂时的错误。 有一个网站重写2.0安装有一个规则是多年没有改变,一切都很好,直到上周一。 两分钟后有一个redirect循环,网站被closures了。 HTTP/1.1 301 Moved Permanently Content-Type : text/html; charset=UTF-8 Location : http://www.exaple.com/ Server : Microsoft-IIS/8.5 X-UA-Compatible : IE=edge,chrome=1 Date : Sun, 25 Sep 2016 23:15:11 GMT Content-Length : 142 事件日志是清楚的 – 没有.NET,APS,系统。 你以前遇到过这样的事情吗? 可能是什么原因?
我真的可以用专家的帮助 目前我们使用反向代理向外界发布多个http网站,都运行良好。 现在我需要给HTTPS访问一个内部的HTPPS站点。 内部HTTPS站点( https://tobadata.internal.lan )可以从运行iis 8.5和urlrewrite 3.0的反向代理服务器访问,所有的证书都可以,没有错误 外部URL的证书(ess.outside.be)安装在rproxy服务器上 证书绑定到在rproxy服务器上运行的特定Web服务器。 我已经复制了我通常用于我的HTTP站点的简单基本规则 <rewrite> <rules> <rule name="ReverseProxyInboundRule1" enabled="true" patternSyntax="Wildcard" stopProcessing="true"> <match url="*" /> <conditions> <add input="{HTTPS}" pattern="On" /> </conditions> <action type="Rewrite" url="https://tobadata.internal.lan/{R:0}" /> </rule> </rules> </rewrite> 使用此设置时,出现错误“502 – Web服务器收到无效的响应,同时充当网关或代理服务器” 我已经启用失败的请求跟踪,捕获502错误,但这不是帮助我,因为它似乎重写规则按预期工作? GENERAL_REQUEST_START SiteId =“2”,AppPoolId =“ess”,ConnId =“1610612741”,RawConnId =“0”,RequestURL =“https://ess.outside.be:443/”,RequestVerb =“GET”14:36 :04.272 GENERAL_ENDPOINT_INFORMATION RemoteAddress =“77.109.122.130”,RemotePort =“53751”,LocalAddress =“192.168.1.80”,LocalPort =“443”14:36:04.288 GENERAL_REQUEST_HEADERS Headers […]
我想重写一些与Nginx的链接,但PHP文件下载而不是执行,如果我在浏览器中运行PHP文件正在工作,所以没有fastcgi的问题。 我已经在这里查了其他类似的问题,但没有任何帮助。 我的nginx.conf文件 …. location / { location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ { expires max; } location ~ [^/]\.php(/|$) { fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass 127.0.0.1:9002; fastcgi_index index.php; include /etc/nginx/fastcgi_params; } } location ~* "/\.(htaccess|htpasswd)$" { deny all; return 404; } location /contact { rewrite ^/contact/?$ /contact.php last; } 我需要重写contact.php /联系,但不工作。 我也试过: location /contact { rewrite ^/contact?$ /contact.php […]
我使用url rewrite 2.0模块为一个子域设置了一个httpredirect到https。 这是web.config代码。 <rule name="HTTP to HTTPS redirect" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{HTTPS}" pattern="off" ignoreCase="true" /> </conditions> <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" /> </rule> 这个redirect在networking中工作。 换句话说,store.domain.comredirect到https://store.domain.com 。 但是,在networking之外,store.domain.com不redirect,也根本不可访问。 在networking内部,可以访问https://store.domain.com 。 我错过了什么? 谢谢!
我在我的服务器上build立了一个nginx。 它接收所有请求并将它们传递给它后面的IIS服务器。 我的问题是,因为我的网站运行在端口2000有时它发送redirect到包含端口2000的nginx,之后,redirect用户将不会通过nginx。 我想在我的nginx中重写一个规则来获取所有redirect,并将端口设置为80,以便用户不直接进入IIS。 我也可以通过更改c#代码来解决这个问题,但我不想更改代码。
我写了下面的URL重写模块来删除响应头中的服务器版本信息。 <rewrite> <outboundRules> <rule name="Remove Server header"> <match filterByTags="None" serverVariable="" pattern=".+" /> <action type="Rewrite" value="" /> </rule> </outboundRules> </rewrite> 这在正常stream程中工作正常。 但是,当一个错误页面(如500或404)呈现时,我能够看到IIS版本信息。 我需要知道如何处理这个错误页面的重写。 任何build议,将不胜感激