how to remove index.php on the URL?

by killua
9 replies
  • WEB DESIGN
  • |
hi everyone!

I got a query.. How do I remove the index.php from my URL? I heard I have to edit .htaccess, but I totally have no idea how to go about doing it and is afraid of removing any important stuffs.

example: example.com/index.php/blog-title

Experts, please help!

[Case closed]
#index.php #indexphp #remove #url
  • Profile picture of the author wayfarer
    The example you gave is nonsensical, as there is no way to create a directory within a page.

    You can link to the root without linking to index.php, just by linking to a forward slash:
    HTML Code:
    <a href="/">Home</a>
    Signature
    I build web things, server things. I help build the startup Veenome. | Remote Programming Jobs
    {{ DiscussionBoard.errors[234124].message }}
  • Profile picture of the author zoobie
    killua, not quite understand of what you are asking..
    the index.php (or index.html) are the default web pages that most web server to configure showing up if someone type for example http://www.xyz.com/
    on the users browsers. and
    are you asking how default goes to http://www.example.com/blog-title/ when some one types in your domain?

    well then you can add a php redirect to the directory /blog-title/
    or you can do htaccess to create a permanent 301 redirect (which also tells the search engine to skip your default home page and index the new directory)

    I personally prefer to use php redirect because it is much easier: (just one line code in your index page and that's it.
    the code:
    <?php
    Header( "HTTP/1.1 301 Moved Permanently" );
    header( 'Location: http://www.yoursite.com/new_page.html' ) ;
    ?>
    and add this to a file name index.php and that's it. That means rename your old index.php to something else if you want to keep that...

    hopes that help
    {{ DiscussionBoard.errors[235146].message }}
  • Profile picture of the author zoobie
    killua, not quite understand of what you are asking..
    the index.php (or index.html) are the default web pages that most web server to configure showing up if someone type for example http://www.xyz.com/
    on the users browsers. and
    are you asking how default goes to http://www.example.com/blog-title/ when some one types in your domain?

    well then you can add a php redirect to the directory /blog-title/
    or you can do htaccess to create a permanent 301 redirect (which also tells the search engine to skip your default home page and index the new directory)

    I personally prefer to use php redirect because it is much easier: (just one line code in your index page and that's it.
    the code:
    <?php
    Header( "HTTP/1.1 301 Moved Permanently" );
    header( 'Location: http://www.yoursite.com/new_page.html' ) ;
    ?>
    and add this to a file name index.php and that's it. That means rename your old index.php to something else if you want to keep that...

    hopes that help
    {{ DiscussionBoard.errors[235155].message }}
    • Profile picture of the author killua
      I'm sorry that I did not explain clearly in my first post.

      If you willing to check on my blog, you will be able to see that for the URL of my every post, it is indicated as
      roycecheng.com/index.php/YYYY/MM/blog-title/

      How do I make the index.php disappear from the URL?

      Your help is greatly appreciated. =)
      {{ DiscussionBoard.errors[235271].message }}
  • Profile picture of the author awesometbn
    Hello killua,
    Check your Wordpress settings. There two items you might need to adjust,

    1. WordPress address (URL)
    2. Blog address (URL)
    {{ DiscussionBoard.errors[235355].message }}
  • Profile picture of the author killua
    hmm.. they are both indicated as roycecheng.com only.
    {{ DiscussionBoard.errors[235391].message }}
  • Profile picture of the author killua
    Thanks guys!

    I had figured out already.

    I have to insert:
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    into my .htaccess file.
    {{ DiscussionBoard.errors[235401].message }}
  • Profile picture of the author awesometbn
    Cool, I knew it must be something simple that was trying to re-write each URL. Great blog by the way. I'll be interested to see more from you. Thanks!
    {{ DiscussionBoard.errors[235847].message }}
  • Profile picture of the author killua
    haha. ya. its simple.. i overlooked it. wordpress actually teaches how to remove it. so sorry.

    thanks! my blog is just reflecting on my life. i really want to learn more about internet marketing. very new to it. hope the people here will be able to help if i face any difficulties. =)
    {{ DiscussionBoard.errors[235856].message }}

Trending Topics