Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am pretty new to this and hence facing a bit of a problem. Currently I am designing a website on my localhost using WordPress.

I noticed that the permalink structure wasn't very appealing in the default mode. I then found that it can be changed through settings and after looking around I found that I wanted %postname% as my custom structure.

After making the change all my links seem to be broken! I cannot access any of the pages or posts.. After searching a bit I found that certain changes need to be made in htaccess file.

According to http://codex.wordpress.org/Using_Permalinks the content in the file should be :

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

On opening the htaccess file the contents were:

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

But neither of the two seem to work.

share|improve this question

3 Answers 3

up vote 0 down vote accepted

You should never have to touch the mod_rewrite rules. WordPress flushes/rewrites them to .htaccess whenever you save settings on Dashboard -> Settings -> Permalinks. If that's not happening, then something is wrong, either with your file permissions, or your local server setup.

Also, it is strongly advised NOT to use %postname% alone as your permalink structure. You will encounter performance issues the larger your site gets, with respect to number of Posts and Pages.

share|improve this answer

Are you using apache2 webserver? Is the module, mod_rewrite enabled?

If not apache, rewrites will never work like this, this is webserver specific code. If only the module, you're missing, turn it on, if you tell me your platform type (windows/xp, linux/centos, etc.) and if windows, your program name, I'll look up, how to enable it.

For example, in ubuntu:

sudo a2enmod rewrite;
sudo /etc/init.d/apache2 restart;

With WAMP: select the wamp icon in the taskbar, right click, and find the mod_rewrite, and enable it with left click.

share|improve this answer

Your line breaks are wrong. This is the correct code:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.