http-status-code-301

Apache CGI redirect to absolute URI doesn't work

浪子不回头ぞ 提交于 2019-12-24 01:59:12
问题 I have Apache 2.2.13 running in console mode on Windows. I have made an executable that handles requests. In a certain case, when it detects a URL pointing to a directory but has not trailing slash, it tries to redirect to the same URL with the missing slash appended. The exit-code is set to 301. Strangely enough, having this in the response header doesn't work: Location: /cgi-bin/mycgi.exe/something/ but this does: Location: something/ Am I doing something wrong? Or did I discover a bug in

PHP code to determine if a user was 301 redirected to my site

别来无恙 提交于 2019-12-24 00:24:55
问题 Is it possible in PHP to know if a user has been 301 redirected to my website? So in myoldsite.com I have a 301 redirect in the .htaccess file to mynewsite.com . Can I place some PHP code in mynewsite.com to recognise when a user has been 301 redirected? I just need this to display a specific message if this is the case. Many thanks for any pointers here :-) 回答1: I believe with 301-redirects the HTTP_REFERER field will contain the original referer: User enters oldsite.com in address bar and

Detect HTTP 301 status code from JavaScript

本小妞迷上赌 提交于 2019-12-23 12:26:29
问题 I need to detect client side if a requested file (with XMLHttpRequest) had a 301 response. The reason of doing this is because I need to request other files related to the file where user has been redirected and not related to the first one requested. Any way to detect this response status code using JavaScript or JQuery? Thanks. 回答1: jQuery ajax callback function gives out a lot of info $.ajax({ url: "test.php", type: "GET", data: {}, dataType:"json", success: function(resp, textStatus, xhr)

I can't update Django's RedirectView. It keeps referring to the old URL with a status of 301 Moved Permenantly

喜欢而已 提交于 2019-12-23 10:09:56
问题 Sorry if this question was supposed to be in Server Vault. I couldn't really tell whether it's a programming error or a server configuration error. I recently pushed my git commits to the live server and I noticed something very frustrating. No matter how I edit the urls.py , I can't seem to update RedirectView ! Here is my root mysite/urls.py urlpatterns = patterns('', url(r'^$', RedirectView.as_view(url=reverse_lazy('order_list')), name='home'), url(r'^doors/', include('doors.urls')), url(r

Get the referral url in javascript

守給你的承諾、 提交于 2019-12-23 09:48:50
问题 I want to see how much traffic I get from various URL shortening services like bit.ly tinyurl.com But because they use 301 redirection, they don't show up in my analytics. How can I find out who is redirecting the traffic? Or More precisely how could i get the referral url in javascript for different kind of redirection ? 回答1: document.referrer Example: if (document.referrer && document.referrer != "") document.write('Thanks for visiting this site from ' + document.referrer); 来源: https:/

How to 301 redirect all pages from one domain to one single page on a different domain

我的梦境 提交于 2019-12-23 04:36:37
问题 I´m trying to do a 301 redirect in a htacess file. I want to point all pages on one domain to one single page on another domain and I do not want to manually redirect all single pages. Ex: www.olddomain.com/1.html and www.olddomain.com/2.html should both point to www.newdomain.com. Hope anyone could help me. 回答1: RewriteCond %{HTTP_HOST} .*olddomain\.com$ RewriteRule ^ http://www.newdomain.com/one-single-page.html [L,R=301] 回答2: I had the same problem but this works fine for me to accomplish

301 Redirect vs. Rel=Canonical

隐身守侯 提交于 2019-12-23 04:24:49
问题 On our site, locale specific URLs are accessible across domains. Say we have two URLs: dog.aspx (English) and hund.aspx (German). The following URLs work: www.example.com/hund.aspx (displays English content, not German,but URL is German) www.example.de/hund.aspx (correct URL) To solve this, we have two options: www.example.com/hund.aspx redirect to www.example.com/dog.aspx Have canonical URL in www.example.com/hund.aspx to www.example.com/dog.aspx What is more preferable? 301 redirect or

How do I 301 redirect one domain to the other if the first has a folder path

人盡茶涼 提交于 2019-12-22 17:52:59
问题 I want to 301 redirect from: www.olddomain.com to the root of newdomain.com but I want it to work no matter what the folder path is on the old domain. eg: the following should all redirect to the root of newdomain.com www.olddomain.com olddomain.com www.olddomain.com/folder/file.php olddomain.com/folder/file.php How can I do that with Mod Rewrite in the .htaccess file? 回答1: Try this rule: RewriteEngine on RewriteCond %{HTTP_HOST} (^|\.)old\.example\.com$ RewriteRule ^ http://new.example.com/

Zend Framework: How to 301 redirect old routes to new custom routes?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-22 05:13:36
问题 I have a large list of old routes that I need to redirect to new routes. I am already defining my custom routes in the Bootstrap: protected function _initRoutes() { $router = Zend_Controller_Front::getInstance()->getRouter(); $oldRoute = 'old/route.html'; $newRoute = 'new/route/*'; //how do I add a 301 redirect to the new route? $router->addRoute('new_route', new Zend_Controller_Router_Route($newRoute, array('controller' =>'fancy', 'action' => 'route') )); } How can I add routes that redirect

Android HttpURLConnection receives HTTP 301 response code

匆匆过客 提交于 2019-12-22 01:40:25
问题 I'm trying to do a HTTP GET using the HttpURLConnection object in Android. UPDATE I tried connection to a different server. This is also hosted within Cloud 9 (c9.io) and also returns a json response. This time I'm not getting a 301 redirect, but I am getting the actual response the server is supposed to send. Since this means the problem is localised within the server, I've reorganized the following sections in order to focus reading onto the server-related information. Android related