Wordpress permalink structure change issue

12,821

Solution 1

Sounds like a problem with symlinks on your server. Try this in your .htaccess and also please change it to 644 after making the change:

Options +FollowSymlinks
RewriteEngine on

# 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

Solution 2

There are many ways how you can fix this issue, if you know the root of the issue.

Problem 1

Firstly, it may be a problem with your apache not having the mod_rewrite.c module installed or enabled.

For this reason, you would have to enable it as follows

Open up your console and type into it, this:

sudo a2enmod rewrite

Restart your apache server.

service apache2 restart

Problem 2

You may also, in addition to the above, if it does not work, have to change the override rule from the apache conf file (either apache2.conf, http.conf , or 000-default file).

Locate Directory /var/www/

Change the Override None to Override All

Problem 3

If you get an error stating rewrite module is not found, then probably your userdir module is not enabled. For this reason you need to enable it.

Type this into the console:

sudo a2enmod userdir

Then try enabling the rewrite module if still not enabled (as mentioned above).

To read further on this, you can visit this site: http://seventhsoulmountain.blogspot.com/2014/02/wordpress-permalink-ubuntu-problem-solutions.html

Solution 3

I had the same problem but i am using other url structure /%category%/%postname%/

The problems with de 404 error is because even if you set a certain structure, wordpress is always trying to create the urls with the word "category" on the url.

Try to type your urls like this: yoursite.com/category/postname, if you are not getting any error now is because we are close to resolving the error. Now try to install this wordpress plugin http://wordpress.org/extend/plugins/no-category-base-wpml/ to remove the "category" base from urls

Let me know about your progress

Share:
12,821
Sait
Author by

Sait

http://saitcelebi.com I probably spend more time than I should in SO.

Updated on June 18, 2022

Comments

  • Sait
    Sait almost 2 years

    I have seen some other posts on SO about this issue, however none of the suggested solutions did work for me, so I repost.

    After changing my permalink structure to /%postname%/, none of the links is working. I get the following 404:

    Not Found
    
    The requested URL /my-post-name/ was not found on this server.
    
    Apache/2.2.20 (Ubuntu) Server at mysite.com Port 80
    

    When I get back to the default permalink structure it starts to work again, but I want to have /%postname%/ structure anyways.

    My .htaccess file's chmod is 777.

    After updating my permalink structure to /%postname%/, the .htaccess file generated by Wordpress is the following:

    # 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
    

    Any thoughts?

    Edit:

    I tried to change permalink structure to the following:

    /index.php/%postname%/
    

    and it happily worked. However, the problem is now, not surprisingly, the links are in the following form:

    www.mysite.com/index.php/my-page.com
    

    My question is how can I remove index.php from my links. When I remove it from the permalink structure (i.e., /%postname%/), my links no longer work.

    PS: Instead of using blog entries I use only pages in my site. If it is necessary my site is: mll.sehir.edu.tr.