Permalinks in Wordpress - Page not found
Asked Answered
T

6

5

I've been searching for hours but haven't found anything that seems to be able to solves this issue.

Here's the scenario:

I'm making a wp theme based on the "Twenty Eleven" theme. Everything went fine til I decided to change the urls to permalinks. The only page being displayed is the static page that I have defined earlier.

I have set up the htacces file. In fact, WP did it automatically. Everything works if I switch back to the default setting, but, for SEO, I would rather use the permalinks option.

Here is my htaccess file (it is on my WP installation folder):

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

# END WordPress

I have seen this post wordpress .htaccess with permalinks but nothing there could help me. Any help would be very nice.

UPDATE : Things I have tried already:

  • Delete pages and create again.
  • Access the permalink field on wp_options (db) and setting the value to blank and set the permalink option in the admin again.
  • I´m running it on windows 7 through an apache2 installation of Zend Server.
  • I thought it was a problem related to my localhost environment, so I put the site online. No luck at all. I'm assuming that wordpress can´t change permalinks to a more friendly url type when you set a static front page. What a shame.
Temperament answered 13/9, 2012 at 16:39 Comment(4)
Unless mysite is the folder your site is in, you should remove it, i.e. RewriteBase / and RewriteRule . /index.php [L].Milk
Yes, it is =) That was added automatically by the wordpress instalator.Temperament
Do you access your site via http://www.example.com/ or http://www.example.com/mysite/ though?Milk
Well, I'm hosting it on my machine, the url is "localhost/mysite".Temperament
E
24

For those using apache. You will need to

  1. Ensure you have .htaccess in root path of the site you are hosting. Example /var/www
  2. Update the /etc/apache2/sites-available/default

From

<Directory /var/www/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
    </Directory>

To

<Directory /var/www/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
    </Directory>

Hope this helps someone

Elston answered 3/11, 2012 at 23:27 Comment(1)
Lovely. It took me 2 days to solve until I found this.Giddy
M
6

If editing apache2's default configuration and Wordpress' .htaccess files don't help the reason could simply be that apache2's rewrite module is not enabled. This is usually the case for those who install apache2 themselves. Wordpress needs apache2's rewrite module enabled to support permalink edits. If, like me, you'd rather not edit conf files by hand, apache2's rewrite module can be enabled by running these commands as root (I'm using Ubuntu 18.04, so these commands might be different in distros that aren't based on Ubuntu or Debian):

    a2enmod rewrite

and restart the apache2 service by running:

    systemctl restart apache2

or

    service apache2 restart

If you're running Ubuntu 18.04, you can check out all available apache2 modules under /etc/apache2/mods-available and see what modules are enabled by listing the files under /etc/apache2/mods-enabled.

Mehalek answered 16/4, 2019 at 8:29 Comment(2)
This solution helped me solve this issue. Also as a note I was running httpd in my server so I had to enable the rewrite module using this guide: e2enetworks.com/help/knowledge-base/…Lookin
@Lookin I'm happy to hear this solution helped. Way to go providing a link to help others learn how to do the same in CentOs. Distros that have little in common usually implement some things differently.Mehalek
A
5

I don't know if you have found the solution to it, but I solved this problem by simply turning on LoadModule rewrite_module modules/mod_rewrite.so in httpd.conf file.

Abbeyabbi answered 9/10, 2012 at 23:53 Comment(0)
V
4

Also see Permalinks on WordPress (Amazon EC2)

I had the same problem, but the author in the above link suggested to do three things (it worked for me!):

Go to /etc/httpd/conf and edit httpd.conf

<Directory />
    Options FollowSymLinks
    AllowOverride All
</Directory>

Change also AllowOverride if it is set to None

# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#
    AllowOverride All

I you haven’t created it yet, place in the root directory of your wordpress installation a .htaccess file with the following contents:

# 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
Varuna answered 26/7, 2013 at 0:4 Comment(0)
P
0

There are two 'Directory' sections in the httpd.conf file. One is for root folder and another for htdocs folder. You must edit both fields to make WordPress pages work again. Hope it helps.

Pastern answered 12/2, 2018 at 5:28 Comment(1)
This rather should have been a comment.Scopophilia
E
0

This worked for me like @Skillachie wrote BUT be also sure to include those settings in the 000-default-SSL.conf file if you use SSL!

<Directory /var/www/PATH>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
</Directory>
Euphonious answered 29/5, 2018 at 4:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.