changing the .htaccess file in wordpress

11,667

You should let wordpress write this file for your localhost server.

You cannot simply copy .htaccess from another server and expect it will work, you have to modify it to reflect your server conf.

You should modify RewriteBase and the last RewriteRule, e.g. for http://localhost/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>
Share:
11,667
NewUser
Author by

NewUser

I am just a beginner in the field of web. I like to know about new technology behind Web Sites and Web Applications.

Updated on June 04, 2022

Comments

  • NewUser
    NewUser almost 2 years

    I was trying to use permalink feature of WordPress on my localhost so I just made copy the code which was generated by WordPress when I clicked on post name from Common Settings. I saved that generated code in my localhost where the wordpress index.php file was stored in the name of .htaccess and now when I am going to visit the page, url bar of the browser is showing the full address of the post but the post can not be seen on the browser.Only the 404 Not Found error is comming. Can someone tell me what is the wrong part here?

  • Paul Leclerc
    Paul Leclerc about 5 years
    @MadanBhandari in the .htaccess file as suggested in the sentence bellow.
  • Jodyshop
    Jodyshop about 4 years
    Thanks, worked as expected. But in case you're hosted your website on windows localhost you only need to change the <code>/wordpress/</code> to your actual directory name. Thanks