URLs not working

If you can reach the homepage of your ProcessWire installation without any problems but you're getting errors (probably 404: Not Found) if you're trying to reach a child page or the admin area it's often caused by a .htaccess setting called "RewriteBase".

In most cases you just have to uncomment (remove the #) the following line:

# RewriteBase /

If you installed ProcessWire in an subdir you have to adjust the RewriteBase to it. So for example if your installation lays in a folder called "pw" (your URL woud look like "http://yoursite.com/pw/") your RewriteBase should look like the following:

RewriteBase /pw/

If this shouldn't help and you're still getting 404s you have to check if the server even recognizes the .htaccess file. Because sometimes hoster don't allow custom .htaccess files.

.htaccess recognition test

Open your .htaccess file and paste a bunch of random characters at the top, like "alkjzb0983t093ozjvozubzb"

Load your site. You should get a "500" Server Error. If this is the case your server recognizes the .htaccess file and you can jump directly to the "mod_rewrite" check.

If not, then Apache isn't reading your htaccess at all. If you're only using shared hosting which means you don't have access to the server configuration files you should contact your hoster.

Otherwise you can fix it yourself:

To fix that you may need to edit your httpd.conf file (/etc/httpd.conf, /usr/local/apache/conf/httpd.conf, or equivalent). To do that, edit the file and locate your directive for the domain where you've installed PW. Add a line within that directive:

AllowOverride All

You might also just want to do that for the whole server, as it's kind of expected in a hosting environment to be able to use .htaccess files and other things. So you could locate your <Directory "/">:

<Directory "/">
 Options All
 AllowOverride All
</Directory>

mod_rewrite test

To check if "mod_rewrite" is installed on your server you can just take the following PHP code and insert it into a file (e.g. "mod_rewrite_test.php") and upload it on your server.

<?php
if(in_array('mod_rewrite', apache_get_modules())) {
  echo 'mod_rewrite is installed.';
} else {
  echo 'mod_rewrite isn't installed.';
}
?>

(via: http://stackoverflow.com/questions/9021425/how-to-check-if-mod-rewrite-is-enabled-in-php)

Afterwards you should know if "mod_rewrite" is installed and running. If it isn't please contact your hoster or if you host your own server install the "mod_rewrite" module yourself.

If it is please go to the forum and ask for help because you probably have an uncommon problem which can better be solved in a conversation.

Next: File related problems »


  1. 500 Internal Server Error
  2. Login Problems
  3. URLs not working
  4. File related problems

Comments

  • David L. Kaplan

    David L. Kaplan 4 years ago 82

    Another cause of "This request was aborted because it appears to be forged" is a too many stale session files that didn't get garbage collected by PW because of some interaction with Ubuntu servers. Adding a couple of lines of php to the config usually fixes it apparently:

    ini_set("session.gc_probability", 1);
    ini_set("session.gc_divisor", 100);

    See:
    https://processwire.com/talk/topic/6001-this-request-was-aborted-because-it-appears-to-be-forged/?p=58636
    https://processwire.com/talk/topic/5796-session-handler-database-do-not-delete-old-sessions/?p=56596

  • Thomas Grahlke

    Thomas Grahlke 3 years ago 32

    On a 1 & 1 domain it works only with the lowest possible in the .htaccess:

    # -----------------------------------------------------------------------------------------------
    # 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]

    # -----------------------------------------------------------------------------------------------
    # 500 NOTE: If using VirtualDocumentRoot: comment out the one above and use this one instead.
    # -----------------------------------------------------------------------------------------------
    RewriteRule ^(.*)$ /index.php?it=$1 [L,QSA]

  • Peter Knight

    Peter Knight 3 years ago 10

    Just wanted to add to this as Ive spent the morning with a 500 error and finally resolved.
    1. Ensure you have debug mode on in your config file. $config->debug = true;
    2. In my case, I had the dbhost in config set to localhost. Make sure your new host doesn't use something different.

Post a Comment

Your e-mail is kept confidential and not included with your comment. Website is optional.