http-status-code-301

How do I 301 redirect /Home to root?

我是研究僧i 提交于 2019-12-02 02:19:31
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 Permanently"; Response.RedirectLocation = "/"; Response.End(); return Redirect("~/"); } However, there's gotta be

Can I use a 301 redirect for included external javascript files?

末鹿安然 提交于 2019-12-01 23:50:48
I am trying to clean up some files on a website, one task being to collate all references to jquery to a singular file. Yes, it's a large site with multiple developers and some standards have not been followed resulting in the current situation where there are various versions of jquery referenced. What I have tried to do is create a 301 redirect for these files to point to a single version. eg: <script type="text/javascript" src="/someurl/js/jquery-1.4.4.min.js"> should end up pointing to /someurl/js/jquery-core.min.js I have tried to do this but it appears to fail to load the new file and

Force browsers to forget cached redirects?

你说的曾经没有我的故事 提交于 2019-12-01 15:51:25
I inherited a domain that previously had a 301 redirect from the root ("/") to "/index.shtml" I've removed the redirect and a different site on the domain, but people who visited the site in the past will have the redirect behavior cached in their browsers... for a terribly long time, unless they manually clear their caches. Anyone trying to go to example.com in these browsers will be sent to example.com/index.shtml before they even make any HTTP requests. Right now this is a huge problem because there is no index.shtml, but is there something I can do with headers to tell browsers to "forget

301 Redirect vs DNS change: Is it ever safe to kill a 301 redirect and update the DNS for a subdomain?

末鹿安然 提交于 2019-12-01 08:36:39
I have a site running at a subdomain that has been migrated to a new server and new domain name. To preserve search credits I know a 301 redirect is the proper way to handle migrating the transition. (The marketing department speaks of 301 redirects like I've never heard of.) From a technical standpoint, I don't understand how long you have to maintain a redirect. Can someone explain this? It seems like extra and unnecessary load on a server to keep a redirect running indefinitely. Do you eventually drop it or make it a DNS change after the search engines have stopped linking to the previous

301 Redirect vs DNS change: Is it ever safe to kill a 301 redirect and update the DNS for a subdomain?

点点圈 提交于 2019-12-01 06:32:21
问题 I have a site running at a subdomain that has been migrated to a new server and new domain name. To preserve search credits I know a 301 redirect is the proper way to handle migrating the transition. (The marketing department speaks of 301 redirects like I've never heard of.) From a technical standpoint, I don't understand how long you have to maintain a redirect. Can someone explain this? It seems like extra and unnecessary load on a server to keep a redirect running indefinitely. Do you

PHP CURL follow redirect to get HTTP status

走远了吗. 提交于 2019-12-01 06:08:16
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); // close handle return $status; } How can I modify this function to follow 301 & 302 redirects

Redirect all request from old domain to new domain

冷暖自知 提交于 2019-12-01 03:27:19
I am looking to migrate from old domain to new domain. I have my old domain olddomain.com and new domain newdomain.com pointing to same ip address for now. I have Apache server inplace to handle requests. How do I 301 redirect all my olddomain.com/* & www.olddomain.com/* to newdomain.com/* Can I get exact regex or configuration that I need to add in htaccess . My newdomain.com and olddomain.com both are being serverd by same apache from same IP so "/" redirect might lead to cycles? And so was looking for effecient way I tried <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_HOST}

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

最后都变了- 提交于 2019-11-30 20:19:05
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! RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !newdomain.com$ [NC] RewriteRule ^(.*)$ http://newdomain.com/$1

Avoiding 301 redirect caching

不羁岁月 提交于 2019-11-30 17:41:35
This is a follow up question to Using 301/303/307 redirects for dynamic short urls , where I try to determine the best method for implementing short url redirection when the destination url will change on a frequent basis. While it seems that 301 and 307 redirects both perform the same way, the issue that concerns me is 301 redirect caching (as documented here )- is the best way to avoid this to use 307 redirects instead (I'm assuming 307 redirects will never cache?), or to explicitly send a no-cache header ("Cache-Control: no-cache, must-revalidate")? Don't try to avoid 301 caching. If you

Nginx Remove WWW And Respond To Both

筅森魡賤 提交于 2019-11-30 13:39:27
问题 I have the following nginx configuration fragment: server { listen 80; server_name mydomain.io; root /srv/www/domains/mydomain.io; index index.html index.php; access_log /var/log/nginx/domains/mydomain.io/access.log; error_log /var/log/nginx/domains/mydomain.io/error.log; location ~\.php { try_files $uri =404; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_intercept_errors on; fastcgi_pass 127.0.0.1:9000; include /etc/nginx/fastcgi_params; }