Jump to content
joeck

[SOLVED] htaccess not all modules supported

Recommended Posts

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

Share this post


Link to post
Share on other sites
Quote

The root/index page is shown but for every subpage i get 404 Errors...

That´s a classical problem. Is your site in the root or in a subdirectory ?
Did you check Allow/Override is configured on your hosting ?
Is your processwire config still pointing to localhost ?
Set debug mode on in your config file. $config->debug = true; to see any error messages.

 

 

  • Like 1

Share this post


Link to post
Share on other sites
Quote

Is your site in the root or in a subdirectory ?

It is in the root directory

4 hours ago, pwired said:

Did you check Allow/Override is configured on your hosting ?

No, I'm awaiting an answer from support. But I think it is configured, as the rewrite rules are working (see attachement).

$config->debug is set to true, but this is not helping as the server is displaying its own 404 Error page, hence I do not see if the config is still pointing to localhost.
I tried to change the servers 404 error page to the /index.php (as in the htaccess file) but this just gave me the index.php page, no matter which link is clicked.

PS: the CSS and some modules CSS are not linked properly as well, maybe this helps in finding the error

 

.htaccess.txt

Share this post


Link to post
Share on other sites
6 minutes ago, joelplambeck said:

hence I do not see if the config is still pointing to localhost.

the idea was to check /site/config.php to confirm the details in $config->httpHosts were correct.

Share this post


Link to post
Share on other sites
13 hours ago, joelplambeck said:

I did the "öalskjfdoal" test in the .htaccess file and didn't get a 500 Error...

Hmm, that means .htaccess file is not working. What happens if you remove the rewrite rules provided by your support? What errors are shown? Apache logs, what do they say?

  • Like 1

Share this post


Link to post
Share on other sites

The $config->httpHosts is set to the root of the customers website (with and without www.*)

1 hour ago, kongondo said:

Hmm, that means .htaccess file is not working. What happens if you remove the rewrite rules provided by your support? What errors are shown? Apache logs, what do they say?

The logs I found do not state a request to the htaccess file... and I still don't get an error with 'asölkdfjasldfj' on first line... As if the server doesn't even care... :-(

In the attachement you find logs with both version of the htaccess file (with and without the 'laksjdföadsf' error)

log.txt

Share this post


Link to post
Share on other sites

OK. But what error do you get in the browser when you remove your supports rules (i.e., using PW .htaccess file as is).. Do you get a 500 Error or 404 Error?

Share this post


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

OK. But what error do you get in the browser when you remove your supports rules (i.e., using PW .htaccess file as is).. Do you get a 500 Error or 404 Error?

I get the exact same error (404 on subpages, index.php is working)

The rules added from the support are not helping me (for the migration) in any way, they simply prove that the htacces file is working/read (somehow).

To be specific: the rules are regarding the old site and simply rewrite a not existing url to an existing url  */test.html to */angebot.html (from the old website/structure). But the new website built with PW has a different (more organised) structure.

I hope my explanation is not too confusing :undecided:

Share this post


Link to post
Share on other sites

You have a backup of your website and database, right ? So, delete everything in the root and database of your Host and then do a fresh new processwire installation. That will tell you if your Host has any restrictions yes or no. As soon as you can do a fresh new processwire installation on your host, you can compare both the .htaccess and the config.php files with the ones you have in your website backup.

  • Like 2

Share this post


Link to post
Share on other sites
19 hours ago, joelplambeck said:

I get the exact same error (404 on subpages, index.php is working)

OK. However, index.php will work even without .htaccess. 

19 hours ago, joelplambeck said:

The rules added from the support are not helping me (for the migration) in any way, they simply prove that the htacces file is working/read (somehow).

This is what I am confused about. If the .htaccess file is working, you should have seen a server 500 error when you added random gibberish text at the very top of the htaccess file. If you didn't, it means the htaccess is not getting read. Maybe repeat the test to confirm?

Could these posts be of help to you?

 

  • Like 1

Share this post


Link to post
Share on other sites

Thank you for your help!

It works now using the web.config file from @matjazp in his post.

special thanks to @kongondo for linking me to the correct topics ^-^

It really is true: PW has a great, friendly and extremely helpful community!

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 Spiria
      I am writing here instead of the ProCache forum because I have the impression that several nginx experts could solve this. In its new version, Procache proposes new .htaccess rules that are difficult to translate into nginx rules. We currently have a problem with the trailing slash of URLs which gives us a bad score in SEO analysis tools such as semrush.com. 
      Indeed, a canonical URL is either without or with "/", but cannot be served by both options. Although ProcessWire without ProCache respects this rule, ProCache has no difficulty serving both, which is considered an SEO optimisation fault. I believe that ProCache version 2 solves this problem with these new rules, but I can't understand the following. Does anyone have any idea how to translate this into a nginx rule?
      Attached also the whole proposed .htaccess for ProcessWire.
      # PROCACHE v2/31885be14d6cfb4b2b0d3e533260bded -------------------------------------------------- RewriteCond %{REQUEST_METHOD} !=POST RewriteCond %{QUERY_STRING} !.*=.* RewriteRule ^.*/$ - [E=pwpcstep:pour,E=pwpcname:index] RewriteCond %{ENV:pwpcstep} "=pour" RewriteCond %{HTTP_COOKIE} !^.*(wire_challenge|wires_challenge).*$ RewriteRule ^.*/$ - [E=pwpcstep:stir,E=pwpcpath:%{DOCUMENT_ROOT}/site/assets/ProCache-00478359c5e65dbada1075bfbd4] RewriteCond %{ENV:pwpcstep} "=stir" RewriteCond %{ENV:pwpcpath}/$0/%{ENV:pwpcname}.html -f RewriteRule ^.*$ - [E=pwpcstep:drink,E=pwpcfile:$0/%{ENV:pwpcname}.html] RewriteCond %{ENV:pwpcstep} "=drink" RewriteRule ^(.*) %{ENV:pwpcpath}/%{ENV:pwpcfile} [L] <ifModule mod_headers.c> Header set X-PWPC "ProCache" env=pwpcstep Header set X-Powered-By "ProcessWire CMS, ProCache" env=pwpcstep </ifModule> RewriteCond %{REQUEST_URI} "^/~?[-_.a-zA-Z0-9/]*$" # /PROCACHE -------------------------------------------------------------------------------------  
      .htaccess-procache
    • By Robin S
      A new module that hasn't had a lot of testing yet. Please do your own testing before deploying on any production website.
      Custom Paths
      Allows any page to have a custom path/URL.
      Note: Custom Paths is incompatible with the core LanguageSupportPageNames module. I have no experience working with LanguageSupportPageNames or multi-language sites in general so I'm not in a position to work out if a fix is possible. If anyone with multi-language experience can contribute a fix it would be much appreciated!
      Screenshot

      Usage
      The module creates a field named custom_path on install. Add the custom_path field to the template of any page you want to set a custom path for. Whatever path is entered into this field determines the path and URL of the page ($page->path and $page->url). Page numbers and URL segments are supported if these are enabled for the template, and previous custom paths are managed by PagePathHistory if that module is installed.
      The custom_path field appears on the Settings tab in Page Edit by default but there is an option in the module configuration to disable this if you want to position the field among the other template fields.
      If the custom_path field is populated for a page it should be a path that is relative to the site root and that starts with a forward slash. The module prevents the same custom path being set for more than one page.
      The custom_path value takes precedence over any ProcessWire path. You can even override the Home page by setting a custom path of "/" for a page.
      It is highly recommended to set access controls on the custom_path field so that only privileged roles can edit it: superuser-only is recommended.
      It is up to the user to set and maintain suitable custom paths for any pages where the module is in use. Make sure your custom paths are compatible with ProcessWire's $config and .htaccess settings, and if you are basing the custom path on the names of parent pages you will probably want to have a strategy for updating custom paths if parent pages are renamed or moved.
      Example hooks to Pages::saveReady
      You might want to use a Pages::saveReady hook to automatically set the custom path for some pages. Below are a couple of examples.
      1. In this example the start of the custom path is fixed but the end of the path will update dynamically according to the name of the page:
      $pages->addHookAfter('saveReady', function(HookEvent $event) { $page = $event->arguments(0); if($page->template == 'my_template') { $page->custom_path = "/some-custom/path-segments/$page->name/"; } }); 2. The Custom Paths module adds a new Page::realPath method/property that can be used to get the "real" ProcessWire path to a page that might have a custom path set. In this example the custom path for news items is derived from the real ProcessWire path but a parent named "news-items" is removed:
      $pages->addHookAfter('saveReady', function(HookEvent $event) { $page = $event->arguments(0); if($page->template == 'news_item') { $page->custom_path = str_replace('/news-items/', '/', $page->realPath); } }); Caveats
      The custom paths will be used automatically for links created in CKEditor fields, but if you have the "link abstraction" option enabled for CKEditor fields (Details > Markup/HTML (Content Type) > HTML Options) then you will see notices from MarkupQA warning you that it is unable to resolve the links.
      Installation
      Install the Custom Paths module.
      Uninstallation
      The custom_path field is not automatically deleted when the module is uninstalled. You can delete it manually if the field is no longer needed.
       
      https://github.com/Toutouwai/CustomPaths
      https://modules.processwire.com/modules/custom-paths/
    • By Peter Knight
      Can anyone tell me which .htaccess directive might be blocking a site import feature from scanning my public_html folder and listing all files and folders.
      These would be both PW files/folders but also some non PW folders which my PW site references for media.
      Latest .htaccess file on Github
      I can see various options from Section 15 onwards (# 15. Access Restrictions (v301)) but nothing that would block both SSH and FTP scans my VPS site import file uses.
      When I point the same site import tool at a non PW site on the same directory it works.
      I could disable htaccess temporarily but it's a busy and active site.
      Thanks
      P

       
       
    • By daniel_puehringer
      Hi Community,

      Sadly I cannot intall ProcessWire on my webserver (Hosted at https://www.world4you.com/de/startseite.html, a small hosting provider in Austria)
      Here is the Problem: 
      1. I downloaded the current masterbranch as a .zip file (After a few tries I also downloaded the code via the git clone command, that led to the same error), unzipped it and transferred it to my server. Since there is already a wordpress site installed on the root directory, I transferred the processwire files into /relaunch and created a subdomain.
      2. I tried to install the language starter kit. As soon as I navigate to that folder Screenshot1 (see attached file 'processWireBug1') is shown. Everything looks nice, except the red text referring to the 'mod_rewrite' rule. The webserver provides the 'apache mod_rewrite' rule.
      3. As soon as I want to press 'Check again' or 'Continue to next step' an error Page with 500 error (see Screenshot 'processWireBug2') occurs.
      4. You can find my .htaccess file attached to this post..htaccess

      How could I solve this issue?

      Some additional information:
      1) the webserver provides the apache mod_rewrite (I checked that several times) and has php version 7.3. installed.
      2) since there is a wordpress site installed on the root directory, there is also a .htaccess file on the root directory. Could this .htaccess file have an impact on the .htaccess file for my processwire website?

      Thanks for your help and greetings from Austria,
      Daniel


    • By horst
      Hi, on a site I want to disable access to original images and only allow to access thumbnails and watermarked image variations.
      EDIT:
      A good solution for protecting original images can be found a bit down in this thread:
       
      Old content of this initial post:
       
×
×
  • Create New...