The problem of changing the structure of Wordpress links

I saw some other posts about SO on this issue, however, none of the suggested solutions worked for me, so I am posting.

After changing my permalink to /%postname%/ none of the links work. 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 return to the permalink default structure, it will start working again, but I want to have the structure /%postname%/ .

My .htaccess chmod file is 777.

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

 # 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 changing the permalink structure as follows:

 /index.php/%postname%/ 

and he happily worked. However, the problem is that it is not surprising that links have the following form:

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

My question is: how to 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 only use pages on my site. If necessary, my website is: mll.sehir.edu.tr.

+7
source share
6 answers

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

 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 
+4
source

There are many ways to fix this problem if you know the root of the problem.

Problem 1

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

For this reason you need to enable it as follows

Open the console and enter into it:

 sudo a2enmod rewrite 

Restart the Apache server.

 service apache2 restart 

Problem 2

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

Find Directory /var/www/

Change Override None to Override All

Problem 3

If you get an error message stating that the rewrite module was not found, your userdir module may not be enabled. For this reason you need to enable it.

Enter this into the console:

 sudo a2enmod userdir 

Then try to enable the rewrite module if it is not already enabled (as described above).

To learn more about this, you can visit this site: http://seventhsoulmountain.blogspot.com/2014/02/wordpress-permalink-ubuntu-problem-solutions.html

+11
source
  • WAMP users (Windows): Some versions of WAMP (all versions?) Do not allow mod_rewrite or allow the following SymLinks by default.
  • To enable the necessary functions, go to the apache / conf / httpd.conf file, open it with a text editor and uncomment the line LoadModule rewrite_module modules / mod_rewrite.so (i.e. remove the hash / pound sign in front of the line).
  • Next, in the same file, there is a section that starts with the line "FollowSymlinks Options".
  • Change the second line in this section from "AllowOverride none" to AllowOverride all.
  • Save the edited httpd.conf file and restart all WAMP modules.

Your permalinks should now work.

+2
source

I had the same problem, but I'm using a different url /% category% /% postname% / structure

The problems with error 404 are related to the fact that even if you set a specific structure, wordpress always tries to create URLs with the word "category" on the URL.

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

Let me know about your successes.

+1
source

Replace and try your .htaccess with this:

Options + FollowSymlinks

Rewriteengine on

RewriteCond% {HTTP_HOST} ^ hostname.com $

RewriteRule ^ (. *) $ Http://www.hostname.com/ $ 1 [R = persistent, L]

0
source

I have this problem when I try to include my site in the permalink to mod_rewrite: "Pretty Permalink". My site is a single instance on AWS EC2.

 404 Errors Page Not Found The requested URL .... was not found on this server. Apache/2.4.7 (Ubuntu) Server at mydomain.com Port 80 

I tried all of the above methods, but not fixed.

Finally, I checked / etc / apache 2 / sites-available / wordpress.conf, I found that I was using the public IP address assigned to each AWS instance. As soon as I change it to the current mydomain.com, it works.

Sometimes wordpress.conf is blocked by httpd (web serser), we need to stop and start it after editing. We also need to use: sudo service apache2 stop / start, since wordpress.conf can be reloaded again.

Hope my experience helps others.

0
source

All Articles