dweeda

.htaccess RewriteRule HTTPS mod causing 404 errors

Recommended Posts

I installed an SSL Certificate, then edited my .htaccess file:

  # -----------------------------------------------------------------------------------------------
  # 9. If you only want to allow HTTPS, uncomment the RewriteCond and RewriteRule lines below.
  # -----------------------------------------------------------------------------------------------
  RewriteCond %{HTTPS} off
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

by uncommenting out the Rewrite lines.

Now I get 404 error pages when I try go to any .../processwire-master/<pagename>/

This includes my admin page at .../processwire-master/processwire/, so i can't get into my admin.

What else do I need to do?

Share this post


Link to post
Share on other sites

Did you set the RewriteBase in the .htaccess?

Share this post


Link to post
Share on other sites

I did not.  Right now they are commented out:

  # RewriteBase /
  # RewriteBase /pw/
  # RewriteBase /~user/
 

 

Share this post


Link to post
Share on other sites

Then try this:
RewriteBase /

 

If it is not working, try this:

RewriteBase /processwire-master/

Share this post


Link to post
Share on other sites

Neither worked.

Symptom: Home page loads with https, but no child pages or admin page - get 404

All pages loaded fine before SSL Cert installed.  Hmm.

Share this post


Link to post
Share on other sites

Sorry, I have no idea what else could cause this. Maybe someone else can jump in? 

Share this post


Link to post
Share on other sites

I know this may sound strange, but when it comes to https and redirects browsers become very "cachehappy"!

When running into problems with this I use the browsers incognito/private mode, have to empty cache, restart browser, use different browser, use a VPN, and so on.

Tiresome sometimes...

  • Like 3

Share this post


Link to post
Share on other sites

If not an .htaccess setting, maybe something down in the /wire/ directory affecting the paths to templates and admin page?? 

Share this post


Link to post
Share on other sites

I installed an SSL Certificate, then edited my .htaccess file:

  # -----------------------------------------------------------------------------------------------
  # 9. If you only want to allow HTTPS, uncomment the RewriteCond and RewriteRule lines below.
  # -----------------------------------------------------------------------------------------------
  RewriteCond %{HTTPS} off
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

by uncommenting out the Rewrite lines.

The main site loads as https, but now I get 404 error pages when I try go to any subpage: .../processwire-master/<pagename>/

This includes my admin page at .../processwire-master/processwire/, so i can't get into my admin.

After this, in .htaccess I  uncommented out   RewriteBase /   and   RewriteBase /processwire-master/

still not working...

Share this post


Link to post
Share on other sites

Could be browser cache?

Share this post


Link to post
Share on other sites

I haved heard this: 

"I know this may sound strange, but when it comes to https and redirects browsers become very "cachehappy"!

When running into problems with this I use the browsers incognito/private mode, have to empty cache, restart browser, use different browser, use a VPN, and so on.

Tiresome sometimes..."

Hmm.  Does this mean only I continue to see this problem?  External site visitors would be OK?

What can I do to solve this?  Even if only for me...  THX

Share this post


Link to post
Share on other sites

Well, there are a lot of folders and files in the /cache/ folder.  I am reluctant to remove them all.  Are there specific files you might have in mind? Or is it truly safe to clear the /cache/ folder?

I am running the latest ver.

Share this post


Link to post
Share on other sites

Is there a way to bump this up the PW chain?  I am dead in the water with my production site.  The https config features of the latest ver help with ports to non-https dev sites, not the other way around.

Thank you to any and all!

Share this post


Link to post
Share on other sites

who is the host?

do u have force www?

Share this post


Link to post
Share on other sites

@dweeda,

Moderator Note

Multithreading is not allowed. Please, do not open different topics regarding the same issue. Keep it in one place. I have merged your other thread with this one.

Share this post


Link to post
Share on other sites

My hosting firm says their Apache server is configured correctly. They believe this is a CMS/Framework issue.

I have tried many different .htaccess settings with no effect. 

One theory is that the PW /cache/ folder is the problem and needs to be emptied. But I'm concerned about making things worse with a broad stroke like that. Something more surgical would be better. Yes? No?

Note, all pages were accessible and the site was up and running before I switched to HTTPS. After, only the top domain URL loads. This includes the admin page.

 

Share this post


Link to post
Share on other sites
Posted (edited)

Over the past few weeks I had two new Processwire sites I switched to https using SSL certs from Letsencrypt.  

I had to deal with numerous settings and things with Linux, Apache and my DNS settings (running on a Linode), but at the actual "processwire level" all I had to do was change .htaccess

  # -----------------------------------------------------------------------------------------------
  # 9. If you only want to allow HTTPS, uncomment the RewriteCond and RewriteRule lines below.
  # -----------------------------------------------------------------------------------------------
  RewriteCond %{HTTPS} off
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

So i can confirm just changing those two lines is sufficient and all pages work.

Not much else I can offer, other than you need to look elsewhere for issues than just those two lines in .htaccess

Edited by Gary Austin

Share this post


Link to post
Share on other sites

Yah, I've basically ruled out .htaccess. But there is something preventing the proper resolution to the correct https URL.  I thought it might be something about templates, but the admin page fails too. So - idk... 

I really need to figure this out soon though.

 

Share this post


Link to post
Share on other sites
On 22.4.2018 at 5:11 PM, dweeda said:

is it truly safe to clear the /cache/ folder?

Yes and no. Don't delete the site/cache/ folder, but everything inside that folder.

btw, I see your site is showing up fine now. It would be nice to tell us what you or your hosting company finally did to make it work (you know, for other users running into the same problem)

Share this post


Link to post
Share on other sites

Well, I have not solved this yet. Unfortunately.

I clicked a host link provided by cstevensjr and modified my .htaccess file appropriately.  No fix.

I also cleared my PW cache folder as per dragan.  But, no fix.

At this point I have tested and made changes for both my host and PW with no effect.  Each is pointing the other way now - so, not unusual :)   Is there a tool my host could use to track what's going on in order to determine the missing and/or problematic link/setting?

Thx to all.

Share this post


Link to post
Share on other sites

If you have not googled "404 only home page working processwire" there are many threads discussing various issues, most involve .htaccess not working and sites in subdirectories. 

  • 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 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 cosmicsafari
      Hi all,
      Just a quick question, when using the multisite module is there anything different that needs to be done in order to setup HTTPS for each of the domains its serving?
      Would a single SSL certificate for the main domain be enough to cover the others aswell or would you need multiple ceritficates one for each domain the mutlisite setup uses?
       
    • By pwfans
      Hello,
      1. Anybody can help, why this htaccess (location in root) doesn't work at 3.0.98 ? it show 404
      RewriteEngine on RewriteRule ^(.*)$ /subdirectory/$1 [L] That rule works in 3.0.62
      It redirect root request to subdirectory processwire installation and hiding the subdirectory name in url.
      I have try to uncomment htaccess inside subdirectory processwire installation :
      RewriteBase /pw/ to RewriteBase /subdirectory/ Doesn't help, still 404 when open the site from root domain.
      2. Is there anyway to find processwire version from processwire files ? not from admin login page.
      Thank you.
    • By rareyush
      I moved my site to Google cloud platform and i am stuck some where.
      my homepage is working fine but when it comes to other pages it says 404 not found
      and when i add this on virtual host 
       
      <Directory "/var/www"> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> or <Directory "/var/www"> AllowOverride All </Directory>  
          I receive internal server error 
       
       
       
      I tried comment out this line to but still same thing 
      # RewriteBase /
      and
        # RewriteRule ^(.*)$ /index.php?it=$1 [L,QSA]
    • By joelplambeck
      Hi Guys,
      I'm trying to do my first migration to the customers existing server (IIS 10) . I ran the site as a subdirectory on my website for test purposes (everything works fine).
      Following the tutorial of Joss, I tryed the site on a local xampp server to make sure, it also works on a root directory. So far so good, everything works.
      Now I moved the files (from the xampp) to the customers server. The root/index page is shown but for every subpage i get 404 Errors...
      Hence I followed the troubleshooting guide for not working URLs:
      On the first sight, the .htaccess file is not recognized, therefore I contacted the host support. They said, it is recognized but not all modules are supported in the processwire .htaccess file. I did the "öalskjfdoal" test in the .htaccess file and didn't get a 500 Error.... BUT the rewrite rule from the hosts support, to proof the file is read, DID work... The support claims, they do not provide debugging... so basically the .htaccess file is recognized and working, but not throwing any errors (for whatever reason).
      Working rewrite rule (from support):
      RewriteEngine On RewriteBase / RewriteRule ^test\.asp$ index.html [NC,L] RewriteRule ^test\.html$ konzept.html [NC,L] RewriteRule ^test2\.html$ team.html [NC,L] The support said, a couple modules are not supported in the htaccess file, the supported ones are listed here: http://www.helicontech.com/ape/ (I think mod_rewrite is supported)
      As I do not completely understand what exactly is happening in the htaccess file, I'm stuck. I tried all suggestions I found regarding this topic on the forum, but none of them solved the problem.
       
      .htaccess.txt