mediamar

Problem with 301 Redirects

Recommended Posts

I moved an old site to processwire and want to redirect the old URLs with php-filenames to the new folders via .htaccess to match the new structure.

I tried:

RedirectMatch 301 /filename.php http://example.com/filename/

The Browser end up like this:
http://example.com/filename/?it=filename.php

Its interfering with that Processwire .htaccess rule

# ----------------------------------------------------------------------------------------------- 

  # Pass control to ProcessWire if all the above directives allow us to this point.
  # For regular VirtualHosts (most installs)
  # ----------------------------------------------------------------------------------------------- 
   RewriteRule ^(.*)$ index.php?it=$1 [L,QSA]
 
If i comment that out the redirect in the URL is ok, but every Klick on a websitelink is showing the homepage.
 
Any idea how i can fix this?
Thanks
 
Andreas

Share this post


Link to post
Share on other sites

Just redirect before the mentioned .htaccess rule. But I'd also suggest looking into ProcessRedirects or Jumplinks, which are GUI modules, where you can set up redirects.

Share this post


Link to post
Share on other sites

Thank you for the quick response. I already tried to apply the rule before, but same result. Is there one of the modules you can recommend?

Andreas

Share this post


Link to post
Share on other sites

Ok. I tried Jumplinks and it works like charm. Thanks again for the quickest support ever seen and http://modules.processwire.com/authors/mike-rockett/.

Have a nice day.

Hi Mediamar,

I'm sure you've already begun digging into the documentation, but you can use the following redirect to match all URIs using a php extension:

Source: {path}.php

Destination: {path}/

Glad you like the module. :)

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Leftfield
      Hi All 🙂

      How to append canonical URL to head from certain templates?

      Thanks!!!
    • 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  
    • By Marco Angeli
      Hi there,
      I added a ssl certificate to my site and I'd like to redirect every single http url to its new https version
      So I added this code in the .htacces file, after the RewriteEngine On :
      Redirect 301 /about https://www.mysite.it/about
      Unfortunately this is now working: I get the "too many redirects" error.
      The following code works, but it's a bulk redirection to the home page, something I don't want for SEO reasons (https://moz.com/blog/save-your-website-with-redirects😞
      RewriteCond %{HTTP_HOST} mysite\.it [NC]
      RewriteCond %{SERVER_PORT} 80
      RewriteRule ^(.*)$ https://www.mysite.it/$1 [R,L]
      Any suggestions?