Articles of redirect

有问题与htaccess(国防部重写和redirect)

我有一个网站在哪里使用mod_rewrite。 RewriteRule ^([^/]*)/([^/]*)\.html$ /?systemdomain=$1&page-slug=$2 [L,QSA] 可以生成一个url等 http://example.com/ny-sample-lawfirm-11415/drug-crimes.html ,这完美无缺。 这个物理path位于 /homepages/profiles 现在是这个问题,如果我有一个url,如; example.com/ny-sample-lawfirm-11415/newdirectory即使存在新的目录( /homepages/profiles/newdirectory ),我也会得到一个404错误 我将需要访问 example.com/ny-sample-lawfirm-11415/newdirectory example.com/ny-sample-lawfirm-11415/newdirectory/sub1 所有这一切都会生成一个404。通过.htaccess解决这个问题的任何方法。 不知道我是否应该修改重写或添加某种types的redirect。 任何帮助,将不胜感激

在nginx中重写/?

编辑:我也有我的洋葱这个问题。 https://tor.stackexchange.com/questions/15099/nginx-directory-disclosures 试图做一个简单的redirect,但我无法弄清楚。 我只是想请求包括最后/正斜杠。 所以/foo被redirect到/foo/ 。 这是我尝试过的一些事情。 rewrite ^/foo /foo/ permanent; location ~ /foo(.*)$ { rewrite ^ /foo/ permanent; } rewrite ^(/foo)(.*)$ http://website.com/foo/ permanent; rewrite ^/(foo.*) /foo/ permanent;

nginx重写通配符找不到path

我正在尝试将Apache .htaccessconfiguration转换为nginx。 以前的设置有很多redirect。 这些似乎大部分似乎虽然我卡在这一个: 我有一个path/support/有索引与我想要的内容,所以这工作得很好。 我有各种/support/all/types/of/things去其他领域的/support/all/types/of/things的列表 – 这些也似乎工作正常。 不过,我也需要一个/support/not-something-from-above来redirect到一个特定的域。 现在我有一个地址块填充重写像这样: location /support { rewrite /article/229/?$ https://something.com/entries/2180 redirect; rewrite /another/?$ https://something.com/elsewhere redirect; rewrite /.*$ https://what-i-want.com redirect; } 在这个块中有更多的重写,但是想法是匹配支持下的各种path,以及它们不排队的地方,将它们发送到最后一个域。 一直以来,保持/support/url是我托pipe的index.html 我努力了: rewrite /\w+$ https://what-i-want.com redirect; rewrite /.+$ https://what-i-want.com redirect; 我已经把它移到了它自己的位置块,特别是在/ support /下,尝试过正则expression式匹配,而且我仍然难倒了。 作为参考,.htaccess看起来像这样 RewriteRule ^support/dynamic/?$ https://something.com/entries/2180 [L,R=301,NC] RewriteRule ^support/toolbar/?$ https://something.com/elsewhere [L,R=301,QSA] RewriteRule ^support/.+$ https://what-i-want.com/ [L,R=301,NC]

我怎样才能使用openvpn作为我的子网中只有一些应用程序的网关

我的networking非常简单: [计算机A 172.18.1.12] -eth0 – [GW] -tun0 — tun0- [VPS] – eth1- [计算机B 172.18.1.12] [eth1] —- [WWW] [计算机* 172.18.1。++] 程序是openvpn安装在GW和VPS上,tun0和class A地址VPS 10.8.0.1 GW 10.8.0.2 我添加了针对VPS的eth1伪装,并且GW0转发的tun0被激活。 我只是想在特殊端口上的某些应用程序使用VPN,所以我添加了一个iptables的snat规则,但没有任何反应。 我只是想重新路由所有数据包端口14000从我的私人子网到互联网上的外部服务器端口14000通过VPN。 感谢帮助我,因为我卡住了:)

Apache2上的PHPMyadminredirect问题

几天前,我在networking服务器上更新了Apache。 这似乎已经打破访问Phpmyadmin通过服务器IP: server.ip/phpmyadmin 现在,当在ip / phpmyadmin上方input时,它将redirect到服务器上托pipe的域。 domain.com/phpmyadmin 它明显地给出了一个404错误,因为/ var / html / www域指向没有Phpmyadmin目录/资源。 我已经尝试了以下,无济于事: sudo dpkg-reconfigure phpmyadmin 检查以下目录是否有任何对phpmyadminredirect的引用: /etc/apache2 /etc/phpmyadmin 有任何想法吗?

将所有未处理的请求redirect到/在nginx中

我必须设置一个有NodeJS后端和一个React webapp前端的服务器。 Nginx和Node应用程序在单独的docker容器中运行,我想这样做: 所有前缀为/api请求都将重新路由到NodeJS应用程序 所有的文件请求将由nginx(html,css,js等)提供,404如果找不到。 其他每个请求都应该被redirect到/ (即前端应用程序) 最后一条规则是需要的,因为这些路由在ReactJS内部处理,但是如果有人重新加载页面,它将得到一个404,因为nginx会尝试加载profile文件。 这是我目前的configuration server { listen 80; root /var/www/myapp; error_page 404 /404.html; location /api { proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_set_header Connection ""; proxy_http_version 1.1; proxy_pass http://app:61337; } location ~* \.(js|css|gif|jpg|jpeg|map|png|svg|ttf|eot|woff|woff2|json|ico)$ { root /var/www/myapp; } location / […]

如何将HTTP和HTTPSstream量redirect到自定义链表iptables

我正在尝试将所有输出HTTP和HTTPS数据包redirect到我的自定义链,但它不起作用 这是我的规则 iptables -t nat -N CUSTOMCHAIN iptables -t nat -A PREROUTING -p tcp –dport 443 -j CUSTOMCHAIN iptables -t nat -A PREROUTING -p tcp –dport 80 -j CUSTOMCHAIN 但是这不起作用,当我尝试使用wget或curl那样的wget somesite.com它不会被redirect。 这是统计输出。 Chain PREROUTING (policy ACCEPT 7 packets, 1418 bytes) num pkts bytes target prot opt in out source destination 1 0 0 CUSTOMCHAIN tcp […]

haproxyredirect不适用于kibana

我的haproxyconfiguration看起来像redirect到5601为kibana不起作用。 为什么? ########################################################################## defaults mode http log global option httplog timeout connect 10s timeout client 30s timeout server 30s frontend http-in bind *:80 acl main path_beg -i /main acl kibana path_beg -i /kibana redirect location main if !main use_backend kibana-backend if kibana default_backend application-backend backend application-backend mode http balance leastconn option httpclose option forwardfor stats […]

Nginx的error_page不提供PHP文件

我试图build立一个404文件,它处理未知的url请求使用error_page指令,该文件即时尝试将其根目录是一个.php文件,这是在path相同的目录。 我无法弄清楚的问题是,只要我创build一个404路由,并定义它的位置似乎下载文件,而不是服务它。 为了testing我不会精神错乱,我把额外的PHP文件放在404规则之外,他们运行并返回内容,但404规则文件只是下载 我的configuration的片段是 root /var/www/itn; index index.php index.html index.htm; location / { try_files $uri $uri/ /index.php$is_args$args; } location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ { access_log off; log_not_found off; expires 1d; } error_page 404 /404.php; location = /404.php{ root /var/www/itn; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /var/www/error/html; } location ~ \.php$ { […]

Apache从url中删除目录

我有一个运行httpd的centos服务器。 我在staging.example.com有一个网站,然后我有staging.example.com/blog或staging.example.com/wiki。 我正在博客部分工作。 这是一个WordPress的安装。 如果您转到staging.example.com/blog,则会转到blog / wp-admin / setup-config.php,如果您尝试inputstaging.example.com/blog/wp-admin,则会redirect到staging.example.com / wp-admin如果您按照链接安装wordpress,则转到staging.example.com/blog/wp-admin/core/core/core/core/core/core/core/core/core/core/core/core /core/core/core/core/core/core/core/core/core/install.php 我在/var/ww/html/example.com上提供了staging.example.com,博客位于/ var / www / html / blog wiki位于/ var / www / html / w 这是我的域特定的configuration: NameVirtualHost staging.example.com:80 <VirtualHost *:80> ServerName staging.example.com ServerAlias staging.example.com DocumentRoot /var/www/html/example.com RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{SERVER_NAME}$1 [R,L] </VirtualHost> NameVirtualHost staging.example.com:443 <VirtualHost *:443> ServerName staging.example.com […]