http-status-code-301

How do you fix Nginx automatically 301 redirecting to the same URL with a trailing slash?

巧了我就是萌 提交于 2019-12-02 21:35:06
问题 I am getting an undesired behaviour from Nginx where it is rerouteing requests when I try to access index files within subdirectories of my web application to the same URL, but with an appended slash. I have a simple web application set up with a root directory, and a number of subdirectories within it, each with a index.php file within them. The server's OS is Ubuntu server, Nginx is the server, and PHP5-fpm is installed. I want to navigate to http://foo/bar to get the output of the index

Redirecting a specific page to another domain

て烟熏妆下的殇ゞ 提交于 2019-12-02 15:42:32
问题 I recently created a new site on a different domain. I need to redirect the index.html of the old domain to the index of the new domain. Usually this would not be a problem, but the old domain is the root domain of the server, the new one is an add on. So the following line would cause a redirect loop because it redirects a.com/index.html and b.com/index.html to b.com/index.html . Redirect 301 /index.html http://b.com/ Is there a way of doing something like this? Redirect 301 http://a.com

How to set all pages of a subdomain to redirect to a single page?

怎甘沉沦 提交于 2019-12-02 12:42:55
Let's say my domain name is website123.com and I have a subdomain of my.website123.com I've deleted the "my" subdomain from the site and want to make sure that anyone that goes to any page with a my.website123.com URL is redirected to the main www.website123.com URL. The "my" subdomain has a ton of pages of it, so I need to make sure that regardless of which page a user goes to on the "my" subdomain, that they're redirected to the site's main index page. I was thinking to get this accomplished through .htaccess - is that the best way? If yes how? @joeh0717 Yes, for an .htaccess file modify it

htaccess - 301 redirect removing part of url

眉间皱痕 提交于 2019-12-02 12:14:48
问题 I'm not able to get to work this 301 redirect, i have to remove "BeTa" word from all the request, and redirect: FROM: http://www.example.com/BeTa/other/content TO: http://www.example.com/other/content "BeTa" could also be present in other part of url: FROM: http://www.example.com/bla/BeTa/other/content TO: http://www.example.com/bla/other/content is it possible? Right now I have only tried the first part: RewriteEngine on RewriteRule ^/BeTa/(.*)$ /$1 [R=301,L] thanks in advance 回答1: You can

301 redirect

与世无争的帅哥 提交于 2019-12-02 11:58:20
问题 How do i redirect a url to domain . eg. http://www.mydomain.com/index.php=HairThing --> http://www.mydomain.com How do i redirect a non-www to www WITHOUT a slash at end ? eg http://mydomain.com ---> http://www.mydomain.com 回答1: See also: Hidden features of mod_rewrite #1 RewriteRule /index.php=HairThing$ http://www.mydomain.com [R=301] #2 RewriteCond %{HTTP_HOST} ^mydomain.com RewriteRule .* http://www.mydomain.com [R=301] However, example case 1, as said by Greg, will always put the / on if

How do you fix Nginx automatically 301 redirecting to the same URL with a trailing slash?

我只是一个虾纸丫 提交于 2019-12-02 10:22:15
I am getting an undesired behaviour from Nginx where it is rerouteing requests when I try to access index files within subdirectories of my web application to the same URL, but with an appended slash. I have a simple web application set up with a root directory, and a number of subdirectories within it, each with a index.php file within them. The server's OS is Ubuntu server, Nginx is the server, and PHP5-fpm is installed. I want to navigate to http://foo/bar to get the output of the index.php within bar . But if I navigate to http://foo/bar I am always redirected to http://foo/bar/ . I have

How to identify if referrer is a 301 redirect

前提是你 提交于 2019-12-02 04:22:48
I'm implementing a slug system for my website at the moment. I plan to redirect invalid slugs to the correct on that is stored in the database. E.g. http://example.com/11/wrong-slug Hit db, check if 11's slug is wrong-slug if not do 301 redirect http://example.com/11/right-slug Detect 301 and inform user that they followed an invalid link Is it possible to identify the 301 redirect preferably using PHP so I can ask the user to update there bookmark etc. Thanks, Jamie. Several solutions come to mind: You could try with get_headers() ah no, it dispatches a request to the URL, which is not what

301 redirect

自古美人都是妖i 提交于 2019-12-02 03:55:46
How do i redirect a url to domain . eg. http://www.mydomain.com/index.php=HairThing --> http://www.mydomain.com How do i redirect a non-www to www WITHOUT a slash at end ? eg http://mydomain.com ---> http://www.mydomain.com Kent Fredric See also: Hidden features of mod_rewrite #1 RewriteRule /index.php=HairThing$ http://www.mydomain.com [R=301] #2 RewriteCond %{HTTP_HOST} ^mydomain.com RewriteRule .* http://www.mydomain.com [R=301] However, example case 1, as said by Greg, will always put the / on if it is without a uri. mydomain.com # impossible mydomain.com/ # possible mydomain.com/foo

htaccess - 301 redirect removing part of url

与世无争的帅哥 提交于 2019-12-02 03:14:14
I'm not able to get to work this 301 redirect, i have to remove "BeTa" word from all the request, and redirect: FROM: http://www.example.com/BeTa/other/content TO: http://www.example.com/other/content "BeTa" could also be present in other part of url: FROM: http://www.example.com/bla/BeTa/other/content TO: http://www.example.com/bla/other/content is it possible? Right now I have only tried the first part: RewriteEngine on RewriteRule ^/BeTa/(.*)$ /$1 [R=301,L] thanks in advance You can tweak your regex to match BaTa anywhere like this: RewriteEngine on RewriteRule ^(.+?/)?BeTa(?:/(.*))?$ /$1$2

Trouble redirecting all pages in a folder to a page at root level

倖福魔咒の 提交于 2019-12-02 03:06:32
问题 I've searched, tried various examples, and none, other than creating an explicit list of redirect statements seems to work. The biggest issue I have is that, although I have access to deploy web pages to the site, I do not have access to any web hosting control panel - site access was inherited, and until now it's been fine, but I think that it is either running an old version of apache, or rewrite rules are not allowed. Anywa, over the years, the site has changed several times, and after