how to remove index.php on the URL?

by 9 replies
11
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]
#website design #index.php #indexphp #remove #url
  • 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>
  • 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:
    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
  • 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:
    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
    • [1] reply
    • 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. =)
  • Hello killua,
    Check your Wordpress settings. There two items you might need to adjust,

    1. WordPress address (URL)
    2. Blog address (URL)
  • hmm.. they are both indicated as roycecheng.com only.
  • 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.
  • 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!
  • 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. =)

Next Topics on Trending Feed

  • 11

    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.