The requested URL /about was not found on this server

Wordpress.HtaccessWordpress Theming

Wordpress Problem Overview


The home page of my wordpress website seems to be displaying correctly but if you click through to any of the other pages I get the following error message:

Not Found

The requested URL /about was not found on this server.

Apache/2 Server at www.wildlionmedia.co.uk Port 80

I'm not sure whether it's a problem with the theme or the .htaccess file that is not being rewritten correctly.

http://www.wildlionmedia.co.uk/

Any ideas how I can resolve the issue?

# Switch rewrite engine off in case this was installed under HostPay.
RewriteEngine On

SetEnv DEFAULT_PHP_VERSION 53

DirectoryIndex index.cgi index.php

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine Off
RewriteBase /wildlionmedia.co.uk/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wildlionmedia.co.uk/index.php [L]
</IfModule>

# END WordPress

Wordpress Solutions


Solution 1 - Wordpress

If all above point not work. Then try this one. I tried it. It's working for me.

  1. Go /etc/httpd/conf/httpd.conf.
  2. Change the AllowOverride None to AllowOverride All.
  3. Restart the apache server.

UPDATE 2017

For new versions of apache the file is called apache2.conf

So to access the file, type sudo nano /etc/apache2/apache2.conf and change the correspondent line inside block <Directory /var/www >

Solution 2 - Wordpress

That's not a typical Wordpress rewrite block. This is:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

See http://codex.wordpress.org/Using_Permalinks#Where.27s_my_.htaccess_file.3F

> Where's my .htaccess file? WordPress's index.php and .htaccess files > should be together in the directory indicated by the Site address > (URL) setting on your General Options page. Since the name of the file > begins with a dot, the file may not be visible through an FTP client > unless you change the preferences of the FTP tool to show all files, > including the hidden files. Some hosts (e.g. Godaddy) may not show or > allow you to edit .htaccess if you install WordPress through the > Godaddy Hosting Connection installation. > > Creating and editing (.htaccess) If you do not already have a > .htaccess file, create one. If you have shell or ssh access to the > server, a simple touch .htaccess command will create the file. If you > are using FTP to transfer files, create a file on your local computer, > call it 1.htaccess, upload it to the root of your WordPress folder, > and then rename it to .htaccess. > > You can edit the .htaccess file by FTP, shell, or (possibly) your > host's control panel.

The easiest and fastest thing to do it reset your permalinks in Dashboard>>Settings>>Permalinks and make sure .htaccess is writable so WordPress can write the rules itself.

And: are you aware you are calling index.cgi as your default document rather than index.php? That's wrong. Remove index.cgi. Or try removing the whole line, too, because defining a default doc on your server may not be needed.

Solution 3 - Wordpress

It worked for me like this:

Go to Wordpress Admin Dashboard > “Settings” > “Permalinks” > “Common settings”, set the radio button to “Custom Structure” and paste into the text box:

/index.php/%year%/%monthnum%/%day%/%postname%/

and click the Save button.

I got this solution from this link

Solution 4 - Wordpress

I deleted the previous .htaccess file and created new one by clicking on save button in Settings->Permalinks

and now that pages started working fine...

Solution 5 - Wordpress

FWIW: I rebuilt a LAMP server from scratch and installed WordPress. I had the same issue after saving my Permalink setting to generate the .htaccess file. Turns out that mod_rewrite was not enabled. I ran across this post on Digital Ocean.
FTA:

> First, we need to activate mod_rewrite. It’s available but not enabled with a clean Apache 2 installation.

$ sudo a2enmod rewrite

> This will activate the module or alert you that the module is already enabled. To put these changes into effect, restart Apache.

$ sudo systemctl restart apache2

Solution 6 - Wordpress

There is a trusted answer on the Wordpress website:

> Where's my .htaccess file? > > WordPress's index.php and .htaccess files should be together in the > directory indicated by the Site address (URL) setting on your General > Options page. Since the name of the file begins with a dot, the file > may not be visible through an FTP client unless you change the > preferences of the FTP tool to show all files, including the hidden > files. Some hosts (e.g. Godaddy) may not show or allow you to edit > .htaccess if you install WordPress through the Godaddy Hosting > Connection installation. > > Creating and editing (.htaccess) > > If you do not already have a .htaccess file, create one. If you have > shell or ssh access to the server, a simple touch .htaccess command > will create the file. If you are using FTP to transfer files, create a > file on your local computer, call it 1.htaccess, upload it to the root > of your WordPress folder, and then rename it to .htaccess. > > You can edit the .htaccess file by FTP, shell, or (possibly) your > host's control panel. > > The following permalink rewrite code should be included in your > .htaccess file (since WordPress 3.0):

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

*Taken from here.

Solution 7 - Wordpress

It worked for me like this:

Go to Wordpress Admin Dashboard > “Settings” > “Permalinks” > “Common settings”, set the radio button to “Custom Structure” and paste into the text box:

/index.php/%year%/%monthnum%/%day%/%postname%/

and click the Save button.

Solution 8 - Wordpress

I found a very simple solution.

  1. Go to Permalink Settings
  2. Use Plain for URL
  3. Press Save button

Now, all pages URLs in WordPress should work perfectly.

You can return the URL to the previous setting and the WordPress will re-generate the URL correctly. I choose Post name in my case and it works fine.

Solution 9 - Wordpress

The selected answer didn't solve this issue for me. So for those still scratching their head over this one, I found another solution!

In my Apache settings httpd.conf(you can find the conf file by running apachectl -V in your console), enabled the following module:

LoadModule rewrite_module modules/mod_rewrite.so

And now the site works as expected.

Solution 10 - Wordpress

Hie,

Although late If anybody suffering from the similar issues here is what you can do to allow permalinks by modifying your virtual host file or whereever you are hosting your WP sites.

So basically everything works fine - you set up permalinks to post and suddenly the url dissapears. You went to a lot of disscussion forums (Like me) tried a lot of modifying and got "Permission to server 403" errors or URL not found error. All you have to do is go to the host file, for example 000-default.conf if using a default virtual host or your config file inside sites-enabled,

use in the directory section :

<Directory "path/to/dir">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>

Donot use the following inside directory

Order allow,deny
Allow from all

The Order and Allow directives are deprecated in Apache 2.4.

Likewise you can setup the directory in /etc/apache2/apache2.conf set the directory for your path and donot use the above - this will cause permission 403 error.

In addition to that you will need to enable mod_rewrite for apache

Solution 11 - Wordpress

Although solution to this problem is hardly coded in regeneration of your .htaccess file; indeed it din't worked for most of you specially when the site is migrated to some new server.

Let's dive into some basics.

Let's assume that for most of us, WordPress environment is running on a PHP server APACHE where this server is controlling most of our environment's initial dependencies. Meanwhile .htaccess generation is also mainly dependent on Apache configurations.

So if that been said, the contribution of .htaccess creation conflict mainly occurs when a WordPress website is migrated from a server running the WordPress environment on old version of Apache and PHP to a newer version of PHP and Apache.

Because dependencies of nrwer and older versions are different that's why the newer version of Apache2 won't allow the .htaccess directives to create a .htaccess file by default; because of which we have to manually set the WordPress website's root directory permissions from "AllowOverride None" to "AllowOverride All".

Comparatively, AllowOverride directive is used to allow the use of .htaccess within the web server to allow overriding of the Apache config on a per directory basis.

Use the following fix to change the apache2.conf directory permission settings:

https://stackoverflow.com/questions/52251640/how-to-deal-with-gcp-wordpress-error-this-page-isn-t-working-example-com-is-cur/52902074#52902074

Solution 12 - Wordpress

Here is another version for Wordpress, original one did not work as intended.

# BEGIN WordPress
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^index\.php$ - [END]
    RewriteCond $1 ^(index\.php)?$ [OR]
    RewriteCond $1 \.(gif|jpg|png|ico|css|js)$ [NC,OR]
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^(.*)$ - [END]
    RewriteRule ^ /index.php [L]
</IfModule>
# END WordPress

Reference from this Github repository, modified a bit. After excessive testing this rule does not solve all problems. We have a Wordpress webshop, which has 40 plugins and somewhere is there a rewrite clash. I sincerely hope next version of Wordpress has no URL rewrites.


RewriteRule ^index\.php$ - [L]

Syntax Rewrite Rule

The ^ signifies start of the string, \ escapes . or it would mean any character, and $ signifies end of the string.

^index\.php$ if http(s)://hostname/index.php - do nothing [END] flag can be used to terminate not only the current round of rewrite processing but prevent any subsequent rewrite processing.


RewriteCond $1 ^(index\.php)?$ [OR]

Syntax Rewrite Condition

In RewriteCond using $1 as a test string references to captured contents of everything from the start to the end of the url http(s)://hostname/bla/bla.php. If used in substitution or condition it references to captured backreference. RewriteRule (bla)/(ble\.php)$ - for http(s)://hostname/bla/ble.php captures bla into $1 and ble.php into $2. Multiple capture groups can be accessed via $3..N.

( ) groups several characters into single unit, ? forces the match optional. [OR] flag allows you to combine rewrite conditions with a logical OR relationship as opposed to the default AND.

In short, if bla/bla.php contains index.php OR next condition


RewriteCond $1 \.(gif|jpg|png|ico|css|js)$ [NC,OR]

( ) groups several characters into single unit, | separates characters to subgroups and conditions them if any one of. [NC] flag causes the RewriteRule to be matched in case-insensitive manner.

In short, if bla/bla.php ends with any of the filetypes OR next condition


RewriteCond %{REQUEST_FILENAME} -f [OR]

Server-Variables are variables of the form %{ NAME_OF_VARIABLE } where NAME_OF_VARIABLE can be a string taken from the following list:

enter image description here

%{REQUEST_FILENAME} is full local filesystem path to the file or script matching the request, if this has already been determined by the server at the time REQUEST_FILENAME is referenced. Otherwise, such as when used in virtual host context, the same value as REQUEST_URI. Depending on the value of AcceptPathInfo, the server may have only used some leading components of the REQUEST_URI to map the request to a file.

-f check for regular file. Treats the test string as pathname and tests whether or not it exists.

In short, if bla/bla.php is a file OR next condition


RewriteCond %{REQUEST_FILENAME} -d

-d check for directory. Treats the test string as a pathname and tests whether or not it exists.

In short, if bla/bla.php is a directory


RewriteRule ^(.*)$ - [END] not as in Github [S=1]

This statement is only executed when one of the condition returned true.

. match any character * zero or more times.

The [S] flag is used to skip rules that you don't want to run. The syntax of the skip flag is [S=N], where N signifies the number of rules to skip (provided the RewriteRule matches). This can be thought of as a goto statement in your rewrite ruleset. In the following example, we only want to run the RewriteRule if the requested URI doesn't correspond with an actual file.

In short, do nothing


RewriteRule ^ /index.php [L]

The [L] flag causes mod_rewrite to stop processing the rule set. In most contexts, this means that if the rule matches, no further rules will be processed. This corresponds to the last command in Perl, or the break command in C. Use this flag to indicate that the current rule should be applied immediately without considering further rules.

In short, rewrite every path as http(s)://hostname/index.php


I fetched this little doc together from apaches.org documentation. Links below.

Solution 13 - Wordpress

in setting > permalinks wordpress set simple and test again.

Solution 14 - Wordpress

I got the same issue. My home page can be accessed but the article just not found on the server.

Go to cpanel file manager > public_html and delete .htaccess.

Then go to permalink setting in WordPress, set the permalink to whatever you want, then save. viola everything back to normal.

This issue occurred after I updated WordPress.

Solution 15 - Wordpress

**Solved Permalink Issue Wordpress **

  1. Login to wordpress dashboard > click on settings > premalinks > then select post name.

  2. After that login to your hosting server goto .htaccess file and replace the code.

    RewriteEngine On RewriteBase / RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]

Solution 16 - Wordpress

Make sure mode_rewrite is enabled in APACHE settings. See link here https://github.com/h5bp/server-configs-apache/wiki/How-to-enable-Apache-modules

Then make sure you have correct .htaccess https://wordpress.org/support/topic/404-errors-with-permalinks-set-to-postname/

And correct virtual host settings in either Apache settings https://stackoverflow.com/questions/18740419/how-to-set-allowoverride-all

Solution 17 - Wordpress

I am working on MacOS, following operation solved my problem:

I copied from : https://akrabat.com/setting-up-php-mysql-on-os-x-10-7-lion/

cd /etc/apache2

Give write permission the config file to root: sudo chmod u+w httpd.conf sudo vim httpd.conf

Find #LoadModule php5_module libexec/apache2/libphp5.so

and remove the leading #

Find #LoadModule rewrite_module libexec/apache2/mod_rewrite.so

and remove the leading #

Find AllowOverride None within the section and change to AllowOverride All so that .htaccess files will work.

Change permissions back: sudo chmod u-w httpd.conf

Restart Apache by running following in terminal:

sudo apachectl restart

Solution 18 - Wordpress

I used http://jafty.com/blog/enable-mod_rewrite-on-apache-ec2-linux-server/ to determine that after upgrading to PHP 5.6 (from 4.9.13) it also update the http (Apache) and I needed to edit the /etc/httpd/conf/httpd.conf file, I quote...

> Basically, you’ll be adding All insted of None to AllowOverride, you > do not want to edit the main directory configuration, you want to edit > the one that looks like this:

<Directory “/var/www/html”>

Not:

<Directory />

Then restart Apache with:

sudo service httpd restart

NOTE - in my tiredness I did change a different Directory element and it made no difference, so ensure you do it for /var/www/html

The article also explains how to check mod-rewrite is enabled.

Solution 19 - Wordpress

On my MacOS Catalina machine I discovered that an additional file had been created at /etc/apache2/users/my-username.conf where the default was

AllowOverride none

Changing that to All finally got things working for me. The challenge with Mac is that its hard to get to these directories with Finder so its easy not to spot this file

Solution 20 - Wordpress

change only .htaccess:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser1096057View Question on Stackoverflow
Solution 1 - WordpressBirendra RawatView Answer on Stackoverflow
Solution 2 - WordpressmarkratledgeView Answer on Stackoverflow
Solution 3 - WordpressClaphamView Answer on Stackoverflow
Solution 4 - WordpressyadavrView Answer on Stackoverflow
Solution 5 - WordpressKeithView Answer on Stackoverflow
Solution 6 - WordpressEric BrottoView Answer on Stackoverflow
Solution 7 - WordpressSeth 666View Answer on Stackoverflow
Solution 8 - WordpressMohammad nagdawiView Answer on Stackoverflow
Solution 9 - WordpresslukeocomView Answer on Stackoverflow
Solution 10 - WordpressDeepesh ThapaView Answer on Stackoverflow
Solution 11 - WordpressZulkifl AghaView Answer on Stackoverflow
Solution 12 - WordpressAkoView Answer on Stackoverflow
Solution 13 - WordpressOmid AhmadyaniView Answer on Stackoverflow
Solution 14 - WordpressaditeView Answer on Stackoverflow
Solution 15 - WordpressAshar ZafarView Answer on Stackoverflow
Solution 16 - WordpressMSaudiView Answer on Stackoverflow
Solution 17 - WordpressHugh WangView Answer on Stackoverflow
Solution 18 - WordpressDevology LtdView Answer on Stackoverflow
Solution 19 - WordpressSimon HView Answer on Stackoverflow
Solution 20 - WordpressaliconView Answer on Stackoverflow