Articles of 301redirect

Apache 301redirect查询stringURL

我想redirect到一个查询string的URL到另一个: example.com/product-category/search/?filter_grade-level=154 至 example.com/product-category/search/?filter_grade-level=k 任何想法在.htaccess添加什么?

301到新的URL和SSL

一个客户想要创build一个301到他的新网站,也碰巧需要ssl。 这是他想要的一个例子: http://www.abc.com to https://www.efg.com https://www.abc.com to https://www.efg.com http://www.abc.com/product?id=1 to https://www.eft.com/product?id=1 https://www.abc.com/product?id=1 to https://www.eft.com/product?id=1 我正在阅读使用.htaccess文件,但它并没有陷入。想知道如果有人可以提出一个例子,将完成上述和解释。 谢谢!

Nginx服务器块:https,非www和非ssl子域

这是我的场景: 两个网站: https://example.com http://dev.example.com 站点1有一个ssl证书。 网站2没有。 (换句话说,我没有通配符ssl证书。) 通过Nginx我试图build立必要的www和HTTPredirect。 网站1的目标是指导 example.com , www.example.com和https://www.example.com …至 https://example.com 站点2的目标是简单地让http://dev.example.com直接指向自己。 我为目标1尝试了什么 # SSL Redirect server { listen 80; server_name example.com; return 301 https://filethemes.com$request.com; } # WWW Redirect server { listen 80; listen 443 ssl; server_name www.example.com ssl_certificate <my-path-here>.crt; ssl_certificate_key <my-path-here>.key; return 301 https://example.com$request_uri } # Site's Primary Server Block server […]

.htaccess 301redirect不起作用

我有一个使用基于PHP的CMS系统的网站。 所以每个页面都是dynamic生成的,就像这样: http://www.shuling.net.cn/index.php?_m=mod_product&_a=view&p_id=87 现在我想redirect这个特定的页面到另一个页面,即: https://www.datanumen.com/sql-recovery/ 所以我写的.htaccess文件如下: redirect 301 /index.php?_m=mod_product&_a=view&p_id=87 https://www.datanumen.com/sql-recovery/ 但是,当我将.htaccess上传到网站的根目录后,这根本不起作用。 我通过编写另一条规则来重新testing,如下所示: redirect 301 /sql/ https://www.datanumen.com/sql-recovery/ 那么这个规则将完美的工作。 为什么? 谢谢

如何将nginx请求代理到tomcatpath?

我有一个域名example.com。 当进入example.com我想代理请求到127.0.0.1:8080/source 我的nginxconfiguration location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $http_host; proxy_pass http://127.0.0.1:8080; } 这适用于127.0.0.1:8080,但我不能让它代理到/源子目录。 当我改变 proxy_pass http://127.0.0.1:8080/source/; 它不能正常工作。 它redirect到http://127.0.0.1:8080/source/ ,但是js和css文件path是/source/js/ *.js和/source/css/ *.css ,其他资源文件是/source/* 。 例如,当浏览器加载html时,它会尝试查找/source/js/ *.js ,因为我redirect到http://127.0.0.1:8080/source/ ,最终path是http://127.0.0.1:8080/source/source/js/ *.js ,但正确的path是http://127.0.0.1:8080/source/js/ *.js 我只是想当我进入example.com ,它将redirect到http://127.0.0.1:8080/source/ ,或者redirect到example.com/source也没关系。

在HAProxy 1.5的帮助下,在数字url之前加上“player-”

我在CentOS 7 Linux上运行一个embedded在Wordpress / Jetty后面的HAProxy 1.5网页游戏。 该网站可以作为http和https访问。 我已经修改WordPress的显示播放器configuration文件页面的url如下所示: https://slova.de/player-12345 其中12345是我的网页游戏中的数字播放器ID。 这工作得很好,但我想简化上面的url https://slova.de/12345 然后使用HAProxy 将“player-”部分预先设置为仅限数字的path 。 所以我已经添加到/etc/haproxy/haproxy.cfg文件的行: http-request redirect code 301 prefix /player- if { path_end /5 } 但是,由于某些原因,导致url不完整: https://slova.de/player-/player-/player-/player-/player-/player-/player-/player-/player-/player-/player-/player-/player-/player-/播放器- /播放器- /播放器- /播放器- /播放器- /播放器- /播放器- / 5 下面是我完整的haproxy.cfg文件来提供更多的上下文: global log 127.0.0.1 local2 chroot /var/lib/haproxy pidfile /var/run/haproxy.pid maxconn 4000 user haproxy group haproxy daemon stats socket […]

nginx不会将httpredirect到https

我有一个nginx docker,运行着多个 site-config文件。 其中之一就是所有http连接的一般redirecthttps: server { listen 80; server_name *.example.com example.com; return 301 https://$host$request_uri; } 所有其他的site-config文件是为我的其他docker/服务如Nextcloud和Plex。 每当我把例如https://plex.example.cominput到我select的浏览器(甚至是IE)中时,它都会显示正确的网页,并显示一个ssh-connection。 但是,inputhttp://plex.example.com只会返回一个空白页面,在这种情况下不会将我redirect到Plex。 任何人有一个想法? PS:默认的site-config文件是空的。 但是由于这样的事实,所有的服务/docker工人的site-configs工作,我猜测,redirect在一个额外的文件不会是问题。 PPS:这是一个访问日志的例子。 错误日志是空的(超过3个月没有新的条目)。 日志是通过https访问我的plex服务器。 通过http访问任何内容都不会创build日志条目。 192.168.0.2 – – [13/Nov/2017:21:53:02 +0100] "GET / HTTP/1.1" 401 157 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko" 192.168.0.2 – – [13/Nov/2017:21:53:02 +0100] "GET /web/index.html HTTP/1.1" 200 1650 […]

Nginx的redirect循环

我试图从一台服务器转移到另一台。 我通常使用apache,但是这个项目使用nginx和Ultimate SEO进行URL修改。 我正在使用相同的nginxconfiguration文件,但我结束了一个redirect循环错误。 以下是site-available中默认文件的内容: # You may add here your # server { # … # } # statements for each of your virtual hosts server { listen 80 default; server_name mysitehere.com; access_log /var/log/nginx/mysitehere.access.log; #fastcgi_param DOCUMENT_ROOT /site/public_html/; location / { root /site/public_html/; index index.php index.html index.htm; # rewrite ^/(.*) http://mysitehere.com/$1 permanent; #rewrite ^/index.php?main_page=shopping_cart$ http://mysitehere.com/index.php?main_page=shopping_cart […]

Nginx:301redirect没有查询string

我将/example.php?var=valueredirect到/index.htm如下所示: rewrite /example.php?var=value / permanent; 但是,浏览器在这里打印最终的uri: domain.com/?var=value 我怎样才能有一个干净的乌里呢? domain.com 谢谢。

你能帮我找出www.example.com改写的example.com来自哪里吗?

这是我的NGINXconfiguration(没有apache,只是php-fpm): user nginx; worker_processes 1; error_log /usr/local/nginx/logs/error.log notice; pid /var/run/nginx.pid; events { worker_connections 384; } http { include mime.types; default_type application/octet-stream; access_log off; server_tokens off; sendfile on; tcp_nopush on; tcp_nodelay off; client_max_body_size 8M; client_body_timeout 30; client_header_timeout 15; keepalive_timeout 15 65; send_timeout 30; gzip on; gzip_static on; gzip_disable "msie6"; gzip_vary on; gzip_proxied any; gzip_comp_level 9; gzip_buffers […]