Jump to content
anthonygustin

.htaccess 301 Redirect Issue

Recommended Posts

Hey all, things had been going well remapping a site from one domain to another, but hit a snag and have searched for hours and don't know how to continue. 

1) I was moving everything from thepaleofix.com to dranthonygustin.com

2) I moved every single path individually with redirects like this: Redirect 301 /category/post http://www.dranthonygustin.com/category/post

Everything smooth sailing until today when through webmaster tools (to say site address as moved) I had to execute "Redirect 301 / http://www.dranthonygustin.com" -- now some of the urls go through and some don't include the / after the .com extension. 

For example:

http://www.thepaleofix.com > http://www.dranthonygustin.com no problem 

http://www.thepaleofix.com/resource/purepharma-m3-review/http://www.dranthonygustin.com/what-does-magnesium-do/ no problem

BUT a bunch of the URLs then don't push... For example:

http://www.thepaleofix.com/recipe/paleo-jam > http://www.dranthonygustin.comrecipe/paleo-jam/ (notice NO / after the .com extension)

and http://www.thepaleofix.com/wp-admin > http://www.dranthonygustinwp-admin (which of course leads to dead link)

There are a bunch of paths that do this, that I checked before and were working, such as: 

Redirect 301 /recipe/paleo-jam http://www.dranthonygustin.com/simple-vanilla-berry-paleo-jam/
 

Any idea why after implementing the / redirect, why it broke some of the redirects and not all? 

 

Thanks! 

Share this post


Link to post
Share on other sites

you would need something like this in your old site's root folder htaccess

RewriteEngine On
RewriteCond %{HTTP_HOST} www.thepaleofix.com.com [NC]
RewriteRule ^(.*)$ http://www.dranthonygustin.com/$1 [L,R=301]

Once the URLs are all forwarding from the old domain, you would then use a combination of htaccess 301, and Jumplinks (module) to handle the differences.

because with the above rules if someone requests

http://www.thepaleofix.com/resource/purepharma-m3-review/

they will definitely be redirected to

http://www.dranthonygustin.com/resource/purepharma-m3-review/

so then your local 301 or Jumplink would do the 2nd 301 to the new page

  • Like 2

Share this post


Link to post
Share on other sites
1 hour ago, anthonygustin said:

 already had set up about 180 of the old URLs to new URL slug paths

where are those - on the old domain?

 

Share this post


Link to post
Share on other sites

ok right, well my technique uses 2 redirects, but does guarantee that every page on the site gets redirected to it's new counterpart without having to do anything extra.

 

  • Like 1

Share this post


Link to post
Share on other sites
On 9/28/2016 at 3:59 AM, Macrura said:

ok right, well my technique uses 2 redirects, but does guarantee that every page on the site gets redirected to it's new counterpart without having to do anything extra.

 

hey can you help me here, I tried your method above but it doesn't work

https://processwire.com/talk/topic/20554-mysitecom-redirected-you-too-many-times/

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Orkun
      Hi Guys
      How can I make a redirect inside the .htaccess to my custom maintenance.html file when any URL of my Website is accessed except the processwire admin (www.example.com/processwire/).
      Because I want that my User's still can access the website when they are loggedin in Processwire.
      When the current url starts with /processwire or if there is a processwire-login-cookie (Is there a cookie when user is logged in Processwire?) available the redirect should not work. Otherwise it should work.
      How can I achieve this?
    • By neophron
      Hi there,
      a few weeks ago I completed a 3.098 installation (server php 7.2). Yesterday I wanted to login but failed. I tried different browsers, meanwhile on two different PCs, but no login.
      Then I realized, that after hitting the »Login« button, there was no message (admin name – Login failed). I also tried all procedures (https://processwire-recipes.com/recipes/resetting-admin-password-via-api/). Then I checked the errors.txt (site/assets/logs) – nothing.
      The frontend works fine. Is there a way to check this Processwire installation? Could be something missing?
       
    • By ridgedale
      Reference: PW 3.0.111 and uikit3 based site using the Regular-Master profile.
      I'm trying to automatically redirect a logged-in user to a custom profile page using $session->redirect() and need to add $user->name to the redirect path.
      All my attempts appear to have failed:
      $session->redirect('/user-profile/')->name; $session->redirect('/user-profile/')->$user->name; $session->redirect('/user-profile/' . get($user->name . '/')); $session->redirect('/user-profile/' & get($user->name)); Can anyone point out where I am going wrong?
    • By Jennifer Stock
      Greetings. I would like to restrict access to certain sections of my organization's ProcessWire site using pubcookie. We are rolling out Shibboleth authentication later this year but for now, it seems I can only make use of our institution's single sign-on routine by utilizing rules in an .htaccess file. 
      I am wondering if there is a way to ask PW to apply these rules to certain pages in the site, whether via template type or location in the page tree:
      AuthType UWNetID PubcookieAppID "MyApplication" require type staff faculty  
×
×
  • Create New...