http-status-code-301

Intercepting backend 301/302 redirects (proxy_pass) and rewriting to another location block possible?

老子叫甜甜 提交于 2019-11-28 10:50:18
We have a couple of backends sitting behind our nginx front ends. Is it possible to intercept 301 / 302 redirects sent by these backends and have nginx handle them? We were thinging something alone the lines of: error_page 302 = @target; But I doubt 301/302 redirects can be handled the same as 404's etc etc... I mean, error_page probably doesnt apply to 200, etc error codes? So to summarize: Our backends send back 301/302s once in a while. We would like to have nginx intercept these, and rewrite them to another location block, where we could do any number of other things with them. Possible?

How do I redirect domain.com to WWW.domain.com under Django?

南楼画角 提交于 2019-11-28 06:37:14
How do I go about redirecting all requests for domain.com/... to www .domain.com/... with a 301 in a django site? Obviously this can't be done in urls.py because you only get the path part of the URL in there. I can't use mod rewrite in .htaccess, because .htaccess files do nothing under Django (I think). I'm guessing something in middleware or apache conf? I'm running Django on a Linux server with Plesk, using mod WSGI The WebFaction discussion someone pointed out is correct as far as the configuration, you just have to apply it yourself rather than through a control panel. RewriteEngine On

Remove Old Permalinks?

妖精的绣舞 提交于 2019-11-28 05:04:10
问题 I have a Wordpress website. I have changed my permalinks several times. All past versions of the permalinks I used are still working. If I type them into the URL bar, I am taken to the page WITHOUT the URL changing/redirecting to the new/current permalink. Why aren't the old permalinks redirecting to the new one? This is causing issues with Google reading duplicate content. Example: .com/lightbulb .com/shop/lightbulb The second URL is old, but still works when I type it in. Shouldn't it

htaccess redirect url with parameters

◇◆丶佛笑我妖孽 提交于 2019-11-28 04:30:32
问题 I have hundreds of links like this: http://www.domain.com/index.php?tag=value I want to redirect all links to http://www.domain.com/value/ Example: Link1 http://www.domain.com/index.php?tag=LW1fdX49tR redirect to: http://www.domain.com/LW1fdX49tR/ Link2 http://www.domain.com/index.php?tag=A3kh0QLIrc redirect to: http://www.domain.com/A3kh0QLIrc/ Link3 http://www.domain.com/index.php?tag=vXwNR4U9qY redirect to: http://www.domain.com/vXwNR4U9qY/ etc How can I do that? Thank you! 回答1: Besides

SEO and 301 redirects - Can they have relative paths or must they be absolute?

ⅰ亾dé卋堺 提交于 2019-11-28 03:35:38
问题 SEO and 301 redirects - Can they have relative paths or must they be absolute? When doing a 301 redirect for a page, are the BOTs/Spiders going to treat a 301 that goes to a relative path (redirect="../") the same as one that goes to an absolute path (redirect="http://www.somewebsite.com/apage/"). For example I have a parent page with content (http://www.somewebsite.com/apage/) on it... I have a subpage (http://www.somewebsite.com/apage/more-details) with further content on it. I plan to move

.htaccess 301 redirect all pages on old domain to a single page on new domain

蹲街弑〆低调 提交于 2019-11-28 02:03:49
I'm looking to redirect each and every page on the old domain to a single page on the new domain. It should also redirect both the www and non-www versions. Every single request to the domain old.com, whatever it may be, should lead to www.new.com root. old.com/1.php www.old.com/2.php old.com/2.php old.com/links/index.php old.com/about-us.html old.com/?string=1 should all redirect to: www.new.com/ I'm looking for a .htaccess solution. You can use RedirectMatch in the old.com vhost RedirectMatch permanent .* http://www.new.com/ Redirect appends the trailing portion of the matched URI to the

301 Redirecting URLs based on GET variables in .htaccess

人走茶凉 提交于 2019-11-28 01:31:41
I have a few messy old URLs like... http://www.example.com/bunch.of/unneeded/crap?opendocument&part=1 http://www.example.com/bunch.of/unneeded/crap?opendocument&part=2 ...that I want to redirect to the newer, cleaner form... http://www.example.com/page.php/welcome http://www.example.com/page.php/prices I understand I can redirect one page to another with a simple redirect i.e. Redirect 301 /bunch.of/unneeded/crap http://www.example.com/page.php But the source page doesn't change, only it's GET vars. I can't figure out how to base the redirect on the value of these GET variables. Can anybody

Htaccess redirect all files from subdirectory in one domain to another domain

南笙酒味 提交于 2019-11-28 00:18:00
I am trying to create a permanent htaccess redirect (301) from all files in one directory in one domain, to another domain as follows: Redirect all files in the following directory: http://www.primary.com/apples/* To: http://www.secondary.com I am not very experienced with htaccess and was wondering if someone can assist me in creating this redirect? Many thanks in advance! This should work in one .htaccess file at primary.com root directory: Options +FollowSymlinks -MultiViews RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www\.primary\.com [NC] RewriteRule ^apples/(.*) http://www

Are 301 redirects possible using javascript or jQuery?

一个人想着一个人 提交于 2019-11-27 22:00:20
I'm running Apache 2.0 and I'm just wondering if it is possible to make a 301 redirect using JavaScript or jQuery. I have an <a></a> tag with href to a specified location and I'm asked to make a 301 redirect when I click that link. This is for SEO and I'm trying to find a way to do the 301 redirect to the same page in the link without having to create a new page or create a form/submit. In short No . JavaScript runs entirely on the client side. 301 redirects are supposed to come as a response from the server. Which means you cannot do this without server support. I know this is an old question

301 redirect .htaccess

允我心安 提交于 2019-11-27 15:34:14
How do I 301 redirect, for example: a subdirectory /Blog/ to /blog/ with .htaccess? Sam Plus Plus Redirect 301 /Blog /blog Or use something like http://www.htaccessredirect.net/index.php The way that immediately comes to mind: RewriteEngine on RewriteBase /path/to/your/web/app RewriteRule ^Blog$ blog [R=301,L] RewriteRule ^Blog/(.*)$ blog/$1 [R=301,L] There are probably much better ways than mod_rewrite, and I'm not 100% sure that the external redirects will work as they should -- you may need the full URL -- but there you go. This is the simplest .htaccess solution, place it in /.htaccess: