http-status-code-301

.htaccess - 301 redirect if no query string present

我们两清 提交于 2019-12-21 23:57:36
问题 i would like to create a 301 from a page to the same page except that the destination page has a parameter in the url. Browsers show me an error (too many redirects) so its seems that there is an infinite loop. This is my code: RewriteEngine on Redirect 301 /index.php http://www.monsite.com/index.php?step=1 thanks to advice me for that :D 回答1: You need to conditionalize the redirect and do it in PHP to prevent the infinite redirect loop. index.php: if(!isset($_GET['step'])){ header('Location

Can a 301 page be crawled by google?

烈酒焚心 提交于 2019-12-21 11:35:23
问题 Is it possible for google or any other crawler to crawl and index a page which returns a 301 status code? I have seen a page in google, which has had a 301 for months. However the cache date of that page in the index is from a few days ago. Can google just ignore the 301 and crawl the contents of a page? 回答1: Google always crawls the target of a redirect, HTTP 301 is not an exception. Could not find a better source than one employee's discussion post, though. Google Search Appliance

How do I use Scala dispatch to get the URL returned in a 301 redirect?

不羁岁月 提交于 2019-12-21 04:20:33
问题 I am using Scala dispatch HTTP library, version 0.10.1. I make a request to a URL that returns an HTTP 301, permanent redirect. For example, http://wikipedia.com returns a 301 that redirects to http://www.wikipedia.org/. How do I do I use dispatch to get the redirected URL? Following the tutorial, here's what I've done. import dispatch._, Defaults._ val svc = url("http://wikipedia.com") val r = Http(svc OK as.String) r() This throws a "Unexpected response status: 301" exception. Presumably I

nginx static index redirect

烂漫一生 提交于 2019-12-20 14:23:40
问题 This seems ridiculous but I've not found a working answer in over an hour of searching. I have a static website running off nginx (which happens to be behind Varnish). The index file is called index.html . I want to redirect anyone who actually visits the URL mydomain.com/index.html back to mydomain.com . Here is my nginx config for the site: server { listen 8080; server_name www.mydomain.com; port_in_redirect off; location / { root /usr/share/nginx/www.mydomain.com/public; index index.html;

nginx static index redirect

耗尽温柔 提交于 2019-12-20 14:23:13
问题 This seems ridiculous but I've not found a working answer in over an hour of searching. I have a static website running off nginx (which happens to be behind Varnish). The index file is called index.html . I want to redirect anyone who actually visits the URL mydomain.com/index.html back to mydomain.com . Here is my nginx config for the site: server { listen 8080; server_name www.mydomain.com; port_in_redirect off; location / { root /usr/share/nginx/www.mydomain.com/public; index index.html;

How do I 301 redirect /Home to root?

℡╲_俬逩灬. 提交于 2019-12-20 02:57:21
问题 Here is my route in Global.asax to remove /Home: routes.MapRoute("Root", "{action}/{id}", new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); Well I need to setup a 301 redirect because someone linked to /Home and they're getting a 404. So how do I setup the 301? I checked the way the route was setting up and it is looking for a "Home" action method in the "Home" controller. So obviously I could add: public ActionResult Home() { Response.Status = "301 Moved

How do you redirect in ColdFusion and control the status code (i.e. 301 instead of a 302)

拈花ヽ惹草 提交于 2019-12-19 17:39:28
问题 This code does a redirect, but uses a 302 status code: <cflocation url="http://stackoverflow.com" addToken="no" /> I found this on the Internet, but I think it only works in ColdFusion8. I am using ColdFusion7. <cflocation url="http://stackoverflow.com" addToken="no" statuscode="301" /> Hoe do you control the status code in ColdFusion7? 回答1: <cfheader statuscode="301" statustext="Moved permanently"> <cfheader name="Location" value="http://stackoverflow.com"> 来源: https://stackoverflow.com

PHP CURL follow redirect to get HTTP status

你离开我真会死。 提交于 2019-12-19 07:58:10
问题 I created the following PHP function to the HTTP code of a webpage. function get_link_status($url, $timeout = 10) { $ch = curl_init(); // set cURL options $opts = array(CURLOPT_RETURNTRANSFER => true, // do not output to browser CURLOPT_URL => $url, // set URL CURLOPT_NOBODY => true, // do a HEAD request only CURLOPT_TIMEOUT => $timeout); // set timeout curl_setopt_array($ch, $opts); curl_exec($ch); // do it! $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); // find HTTP status curl_close($ch)

How to undo a 301 redirect?

百般思念 提交于 2019-12-19 06:26:08
问题 Now, I don't have any problems with 301 redirects, but one person asked me for the way to undo cached 301 redirects for browsers and search engines, so I replied "by doing a 301 redirect back to the original url", at least thats what I thought was the solution, until I saw people mentioning that you can't do a 301 redirect back http://getluky.net/2010/12/14/301-redirects-cannot-be-undon/ http://www.velocityreviews.com/forums/t500058-undo-301-redirect.html this was a surprise and I don't know

How to 301 redirect all pages to the same pages on new domain

天大地大妈咪最大 提交于 2019-12-19 02:47:42
问题 I'm moving my site from old-domain.com to new-domain.com with exactly the same pages, e.g., if old-domain.com has a page1.html (i.e., old-domain.com/page1.html) then the new domain has the same page, i.e., new-domain.com/page1.html I tried this in the .htaccess file: RewriteEngine on RewriteRule (.*) http://new-domain.com/$1 [R=301,L] But only while old-domain.com will redirect to new-domain.com, old-domain.com/page1.html will not redirect to new-domain.com/page1.html Thanks! 回答1: