WordPress.org

Forums

How to use Post name permalinks (5 posts)

  1. rohitbhalara4
    Member
    Posted 2 years ago #

    Hi

    Right after installation the first chnage in the settings I made was to change the Default type permalinks settings to Post name type.
    But after I create a page I can't access that page and I get a 404 Not Found error.

    For example, I created a page as http://localhost/mysite/my-page/ as it shows against the page permalink but I get a 404 Not Found error when I try to access it?

    Could someone help me understand why is it happening and how to fix it?

    Thanks.

  2. genzki
    Member
    Posted 2 years ago #

    Try this.

    Settings -> Permalinks -> Select Post Name

    If the Post name was already checked try to Set it on the default then save then try to put it back to Post Name.

  3. rohitbhalara4
    Member
    Posted 2 years ago #

    I had Settings -> Permalinks -> Post Name selected even before I created my first page.
    I tried changing permalinks to Default type and then again back to Post name but it still did not work.
    It started working after un-commenting #LoadModule rewrite_module modules/mod_rewrite.so line in httpd.conf inside conf folder of apache configuration.
    So basically, I had to turn on the mod_rewrite which was off by default.

    I thought turning mod_rewrite on was needed only if the pages/posts were created using the Default type selected for permalinks and then later a change was required to make those permalinks Post name type.

    Thanks for the reply genzki :) and please correct me if got somrthing wrong here.

    Thanks.

  4. genzki
    Member
    Posted 2 years ago #

    Before anything else please backup your current htaccess into safe folder.

    then after that try to delete your htaccess into your wordpress folder. then go to the same process.

    Settings -> Permalinks -> Select Post Name

    wordpress generates htaccess.

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

    # END WordPress

  5. rohitbhalara4
    Member
    Posted 2 years ago #

    Thanks for the reply again genzki, the .htaccess file that I have inside my project installation folder has exactly the code that you posted in your reply.

    Did you mean to say that by default this code doesn't exist in .htaccess and it only after I manually uncommented the #LoadModule rewrite_module modules/mod_rewrite.so in httpd.conf it would have got written in .htaccess?

    Did you mean to say that I could bypass uncommenting #LoadModule rewrite_module modules/mod_rewrite.so line in httpd.conf just by writing the code given by you in your reply?

    Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic