Articles of 301redirect

基于Apache2名称的虚拟主机总是redirect301

我有一个Apache 2.2服务器(运行Debian Squeeze),有4个站点在那里运行。 我使用基于名称的虚拟主机,因为我有一个IP。 Webmin已经完成了初始configuration,可能有些东西已经搞乱了。 firstdomain.com是我的默认域,并正常工作,seconddomain.com是另一个正在工作的网站。 现在我想添加lastdomain.tk作为一个新的网站,所以我做了这个configuration文件: root@webamp:/etc/apache2# cat sites-available/lastdomain.tk.conf <VirtualHost *:80> DocumentRoot /home/server/Condivisione/RAID/lastdomain.tk ServerName www.alazanes.tk ServerAlias alazanes.tk </VirtualHost> 我已经添加到启用网站,并重新启动Apache。 问题是,如果我去lastdomain.tk(或www.lastdomain.tk)我redirect到firstdomain.com 301redirect。 lastdomain.tk和www.lastdomain.tk都是指向我的IP地址的DNSlogging。 奇怪的是,如果更改了lastdomain.tk的DocumentRoot DocumentRoot /home/server/Condivisione/RAID/Sito_SecondDomain 我正确地看到seconddomain.com内容没有被redirect(lastdomain.tk显示在地址栏上) 这些是我正在使用的其他configuration。 root@webamp:/root# source /etc/apache2/envvars ; /usr/sbin/apache2 -S VirtualHost configuration: wildcard NameVirtualHosts and _default_ servers: *:443 webamp.firstdomain.com (/etc/apache2/sites-enabled/ssl.bbteam:1) *:80 is a NameVirtualHost default server firstdomain.com (/etc/apache2/sites-enabled/000-default:7) port 80 namevhost […]

Nginx + WordPress:移动到WordPress后redirectURL

我有一个分类广告网站使用专有脚本,现在我把它移动到Wordpress。 我想将旧urlredirect到Wordpressurl。 该脚本有两个主要的URLtypes: 类别url: /category/id-of-category[/page-number]/category-name.html 例如。: /category/15/cars.html /category/15/3/cars.html(3是分页) 它应该redirect到/?cat = 15 列表url: /category/id-of-category/category-name/listings/id-of-ad/ad-title.html 例如。: /category/15/cars/listings/12345/selling-my-old-toyota.html 它应该redirect到/?p = 12345 我想知道确切的nginxconfiguration,将永久redirect到相同的域名上的新的URL。

nginx使用proxy_pass和$ http + CloudFlareredirect循环

我的nginxconfiguration很好,直到我添加一个强制HTTPS的redirect。 redirect之前的工作configuration是: server { listen 80; listen 443 default_server ssl; server_name my-domain.com www.my-domain.com; client_max_body_size 5M; location / { proxy_pass http://localhost:3000; } } 我在服务器的端口3000上运行一个应用程序,我想在端口80和端口443(http和https)的域中提供它。 不过,我也希望在用户尝试通过HTTP访问时将用户redirect到HTTPS。 我用这个答案来设置: server { listen 80; server_name my-domain.com www.my-domain.com; client_max_body_size 5M; return 301 https://$server_name$request_uri; } server { listen 443 default_server ssl; server_name my-domain.com www.my-domain.com; client_max_body_size 5M; location / { proxy_pass http://localhost:3000; } […]

为什么https://www.foobar.comredirect到自己?

我没有任何build议https://www.foobar.com应该redirect到https://www.foobar.com规则。 但为什么这样做呢? 这是我的curl输出: curl -Ik https://www.foobar.com HTTP/1.1 301 Moved Permanently Content-Length: 184 Content-Type: text/html Date: Wed, 11 Feb 2015 07:22:11 GMT Location: https://www.foobar.com/ Server: nginx/1.4.7 Connection: keep-alive Nginxconfiguration: upstream unicorn_www.foobar.com { server unix:/srv/www/foobar/shared/sockets/unicorn.sock fail_timeout=0; } server { listen 80; server_name foobar.com; return 301 https://www.foobar.com$request_uri; } server { listen 80; server_name www.foobar.com; return 301 https://www.foobar.com$request_uri; } […]

Apache httpd不会更新到301redirectconfiguration

我在更新apache服务器(httpd,rhel)中以前的redirect时遇到问题。 我曾经有过: RedirectMatch 301 ^/apidocs/ /old/specific/path/apidocs/ 哪些工作。 我把它改成: RedirectMatch 301 ^/apidocs/ /new/specific/path/apidocs/ 现在它不起作用。 也就是说,当我尝试点击简单的http:// <host> / apidocs url时,我在响应头文件中获得了一个具有旧的redirect位置的301,在浏览器中跟着一个404,当它尝试从旧的位置。 httpd错误日志证实浏览器试图获取旧的目录: File does not exist: /var/www/html/old 做service httpd reload或service httpd force-reload仅产生以下单行输出: Reloading httpd: …所以这可能是成功的。 也, (1)httpd启动时,其错误日志没有任何投诉。 (2)运行apachectl configtest生成Syntax OK 。 (3)运行httpd -t生成Syntax OK 。 (4)我停下来“优雅”地开了几次httpd,都无济于事。 (5)我试过用apachectl -k stop / start,无济于事。 (6)我现在也尝试使用htcacheclean清除caching,无济于事。 在这里值得注意的是,以前尽pipemodcaching和modcaching磁盘模块被加载,没有configurationCacheRoot等,因此我添加了以下内容: CacheEnable disk / CacheRoot "/var/cache/httpd" […]

使用Nginx的子目录redirect

当我的浏览器,我打电话给http://myhost/tiles/yellow/1/2/3.png ,我期望从http://myhost/cache/yellow.png获得内容我的configuration是以下 location /cache/ { alias /my/path/cache/; } location /tiles/ { try_files $uri $uri/ @rulestiles; } location @rulestiles { rewrite "^/tiles/([a-zA-Z1-9]*)/[0-9]{2}/[0-9]{6}/[0-9]{6}\.png$" /cache/$1\.png permanent; } 我错过了什么? 是否因为我不需要所有参数,所以我不使用捕捉function? 我也不想使用符号链接,因为我只需要几百个真正的文件需要数百万的符号链接… 感谢任何指导/帮助

确认代码redirect主域而不是子域

我们第一次(22年前)域silver-cross.com和几年后收购silvercross.com目前,silver-cross.com和silvercross.com都使用相同的索引文件,我们想解决这个问题。 我们担心的是,如果我们从silver-cross.com执行301永久redirect到silvercross.com,这可能会影响我们子域调查中的主数据库..silver-cross.com 任何人都可以为这个问题确认下面的代码吗? RewriteEngine On # Redirect anything except survey.silver-cross.com RewriteCond %{HTTP_HOST} !^(survey)\.silver-cross.com$ [NC] RewriteCond %{HTTP_HOST} ^www\.silver-cross\.com$ RewriteRule ^/?$ "http\:\/\/www\.silvercross\.com" [R=301,L]

Nginx的proxy_pass和redirect

我试图清理我的反向代理nginxconfiguration我的url。 我的configuration看起来像这样 upstream blog { ip:port; } server { listen 80; server_name domain.tdl www.domain.tdl; rewrite ^/index.html$ / redirect; rewrite ^(/.+)/index.html$ $1 redirect; if ($request_uri ~* ".html") { rewrite (?i)^(.*)/(.*)\.html $1/$2 redirect; } location / { rewrite ^/(.*) /$1 break; proxy_pass http://blog; } } 只要我博客上的端口是80,一切正常。 但是,如果我改变了其他的东西,nginx会尝试将我的请求redirect到domain.tdl:port,这显然不起作用。 我厌倦了proxy_set_header和proxy_redirect的许多组合,但没有为我工作。 根据要求更多的细节,所有的输出都来自curl -Lv : 我将ip:port设置为ip:8000 < HTTP/1.1 301 Moved Permanently […]

为什么AWS S3redirect显示为302而不是301?

我在S3中使用这个博客post实现了一个301redirect。 它明确表示redirect将是一个301,这是我想要的。 元数据的屏幕截图: redirect是从http://www.trevormckendrick.com/legal-entity到http://www.zerotoentrepreneur.com/basic-legal-entity-info-start-here/ 但是当我curl的第一个url,它出现为302。 此外,Moz显示了两个单独的redirect,一个用于 “ http://www.trevormckendrick.com/legal-entity ” 和另一个 “ http://www.trevormckendrick.com/legal-entity/ ” (注意string末尾的尾部“/”)。 我错过了什么? (不知道这是否会影响它,但我刚刚从Github Pages网站移动到AWS昨晚。)

Nginx:反向代理和httpredirect到https

我目前使用反向代理将my.domain.com映射到端口5000,但也希望将httpstream量redirect到https。 我不想添加SSL证书信息,因为这些都是由Cloudflare处理的。 这是我的工作反向代理: server { listen 80; server_name my.domain.com; proxy_set_header X-Real-IP $remote_addr; location / { proxy_pass http://localhost:3000; } } 这是我的破解( ERR_TOO_MANY_REDIRECTS )尝试将httpsredirect添加到反向代理。 server { listen 80; server_name my.domain.com; return 302 https://my.domain.com$request_uri; } server { listen 443; server_name my.domain.com; proxy_set_header X-Real-IP $remote_addr; location / { proxy_pass http://localhost:3000; } }