http-status-code-301

Redirect multiple domains to one domain (with or without www before)

♀尐吖头ヾ 提交于 2019-11-27 11:17:09
问题 I have about 18 domains that need to be redirected to a new one. It has to work both with or without www prepended. I've tried this: <IfModule mod_rewrite.c> RewriteEngine on Rewritecond %{HTTP_HOST} !^www\.domain\.com RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L] </IfModule> That gives me a redirect loop (and only works with www before, i think?). 回答1: RewriteEngine on RewriteCond %{HTTP_HOST} ^domain1.com [OR] RewriteCond %{HTTP_HOST} ^domain2.com [OR] RewriteCond %{HTTP_HOST}

What's the difference between HTTP 301 and 308 status codes?

血红的双手。 提交于 2019-11-27 10:43:06
What's the difference between HTTP 301 and 308 status codes? 301 (Moved Permanently): This and all future requests should be directed to the given URI. 308 (Permanent Redirect): The request and all future requests should be repeated using another URI. They seem to be similar. An overview of 301 , 302 and 307 The RFC 7231 , the current reference for semantics and content of the HTTP/1.1 protocol, defines the 301 (Moved Permanently) and 302 (Found) status code, that allows the request method to be changed from POST to GET . This specification also defines the 307 (Temporary Redirect) status code

What is the best approach for redirection of old pages in Jekyll and GitHub Pages?

家住魔仙堡 提交于 2019-11-27 09:10:52
问题 I have blog on github pages - jekyll What is the best way to solve url strategy migration? I found the best practice in common is create htaccess like so Redirect 301 /programovani/2010/04/git-co-to-je-a-co-s-tim/ /2010/04/05/git-co-to-je-a-co-s-tim.html But it does not seems to work with Github. Another solution i found is create rake task, which will generate redirection pages. But since it's an html, it's not able to send 301 head, so SE crawlers will not recognize it as an redirection.

.htaccess redirect without changing address bar

不羁岁月 提交于 2019-11-27 08:17:58
I'm trying to write an .htaccess rule to redirect to a script, which further redirects somewhere else. Kind of like how URL shorteners work. However, I don't want the address bar to change during the .htaccess part of the redirect. (It's okay for the script redirect to change the location.) I'm using mod_rewrite , currently doing this: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteBase / RewriteRule (.+)$ "?url=$1" [L,R=301] Is there a flag or another method I can use to achieve what I'm trying to do? Addenda : The location bar doesn't change in Firefox as the redirects are

How do I programatically 301 redirect in an asp page?

旧时模样 提交于 2019-11-27 07:22:00
问题 I'm upgrading some classic asp pages to .net, but not all of them. Rather than go and modify all the links in this backwards system, which pulls some of its links from a cms data store. I would like to take advantage of http and just remove the code our of that file, and perform a programatic 301 so that all the other pages can just be upgraded piecemeal. 回答1: Response.Buffer = true Response.Status = "301 Redirect" Response.AddHeader "Location", "redirection-url-goes-here" Response.End 来源:

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

情到浓时终转凉″ 提交于 2019-11-27 05:42:17
问题 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 回答1: The WebFaction discussion someone pointed out is correct as far as

.htaccess 301 redirect of single page

删除回忆录丶 提交于 2019-11-27 03:57:38
问题 After a site redesign, I've got a couple of pages that need to be redirected. Everything is staying on the same domain, just a couple of things have been reorganised and/or renamed. They are of the form: /contact.php is now: /contact-us.php Using the .htaccess file, I've added this line, which is the one I find recommended most: RedirectMatch 301 /contact.php /contact-us.php This is mostly fine - it does the job - the problem is, it also redirects: /team1/contact.php /non-existant-folder

htaccess 301 redirect issue with url variables

血红的双手。 提交于 2019-11-27 03:34:10
问题 If I use this code, it's successful: Redirect 301 /products.php http://website.com.au/product_123.php But if I do this, it isn't: Redirect 301 /products.php?id=123 http://website.com.au/product_123.php Note the variable in the url is what's causing it to fail. What am I doing wrong? Is there another way to do this? I really need the urls variables. 回答1: You can't put query string parameters in the source URI path of the Redirect directive. You'll have to use mod_rewrite's %{QUERY_STRING}

.htaccess 301 redirect of single page

扶醉桌前 提交于 2019-11-27 00:55:16
After a site redesign, I've got a couple of pages that need to be redirected. Everything is staying on the same domain, just a couple of things have been reorganised and/or renamed. They are of the form: /contact.php is now: /contact-us.php Using the .htaccess file, I've added this line, which is the one I find recommended most: RedirectMatch 301 /contact.php /contact-us.php This is mostly fine - it does the job - the problem is, it also redirects: /team1/contact.php /non-existant-folder/contact.php Is there a way of specifying that I only want to redirect the contact.php in the root?

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

扶醉桌前 提交于 2019-11-26 23:36:32
问题 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. 回答1: You can use RedirectMatch in the old.com vhost