Forums

How does WordPress maintain the "pretty URL" through .htaccess? (6 posts)

  1. linksku
    Blocked
    Posted 1 year ago #

    According to WordPress's .htaccess file, everything becomes index.php. Then, WordPress parses the URL to display the correct content.

    How does WordPress maintain the URL? Why doesn't the URL become index.php?

  2. Indeedle
    Member
    Posted 1 year ago #

    Mod rewrite doesn't automatically redirect, instead it will keep the fancy URL in your address bar. The accessing of the index file is private basically.

    You might want to read up on mod rewrite to learn more about the process, as it is interesting.

  3. lhernandez
    Member
    Posted 1 year ago #

    ADD this to your .htaccess file.

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

  4. FMNETWORKS
    Member
    Posted 1 year ago #

    where i can get the .htaccess file

  5. chriseverson
    Member
    Posted 1 year ago #

    It should already be created. You may have to enable "View Hidden Files" or something to that affect in your FTP client.

    If not, just create a new file called ".htaccess" in the root directory and paste in the code above.

    More info can be found in the Using_Permalinks article in the codex.

  6. Slamlander
    Member
    Posted 1 year ago #

    This only applies to Apache hosted sites. '.htaccess' does not exist on IIS hosted sites.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags