How to Remove index.php from URLs in Joomla 3

seo-settings-use-url-rewriting
 

As we continue to review the SEO settings in Joomla 3.0, the next option we get to is Use URL rewriting. In our testing, we noticed that when the Use URL rewriting option was enabled, index.php was removed from our URLs. In this tutorial we’ll show you how to use this Use URL rewriting tool in Joomla 3.0.

 
Don’t have time to read our full article? Watch our walk-through video.

Please be sure to take note of the following:

Select to use a server’s rewrite engine to catch URLs that meet specific conditions and rewrite them as directed. Available for IIS 7 and Apache.
Apache users only! – Rename htaccess.txt to .htaccess before activating.
IIS 7 users only! – Rename web.config.txt to web.config and install IIS URL Rewrite Module before activating.

This setting only takes effect if your set Search Engine Friendly URLs to Yes.

To enable Use URL rewriting in Joomla 3.0:

  1. Log into your Joomla 3.0 dashboard
  2. In the left menu, click on the Global Configuration link under the SYSTEM heading
  3. There are several tabs at the top of the page. If you are not on the Site tab, click Site.
  4. On the right side of the page, find the Use URL rewriting option (see the screenshot at the top of the article). Adjust the setting to Yes / No, and then click Save in the top left menu.

    You can see in the table below how Use URL rewriting affected one of our URLs:

    Use URL rewriting – YES
    https://domain.com/2-uncategorised/1-this-is-my-first-test-article
    Use URL rewriting – NO
    https://domain.com/index.php/2-uncategorised/1-this-is-my-first-test-article

32 thoughts on “How to Remove index.php from URLs in Joomla 3

  1. Hello, how do I remove /index.php from hompage URL? I already used redirection but it isn’t working. Where i’am wrong?

    I used this in my .htaccess file:

    <IfModule mod_rewrite.c>

    RewriteEngine On

    RewriteBase /

    RewriteRule ^index\.php$ - [L]

    RewriteCond %{REQUEST_FILENAME} !-f

    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule . /index.php [L]

    </IfModule>

    1. You should be able to use the following in your .htaccess file:

      RewriteEngine On
      RewriteBase /
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)$ index.php?$1 [L,QSA]
      RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s(.*)/index\.php [NC]
      RewriteRule ^ %1 [R=301,L]

  2. After many days, I think that I need to remove index.php from my website colorta.com But i am feeling a problem. If I remove index.php may something rewrite on my server? May have problem with urls? But is index.php may harmful for getting a better search engine? I dont know.

    1. Hello Mithu,

      Thank you for contacting us. If you have added any custom rules to your .htacces file, it may cause issues.

      But, since this is just a standard setting in Joomla, so it should be fine to use it.

      Only Google knows how this may affect your search engine results. I recommend reviewing your stats in Google Analytics to determine if it is affecting your traffic.

      Thank you,
      John-Paul

  3. my ip is https://192.232.251.130/~efulgent/wishesh/

    I have changed Use URL rewriting to yes and renamed htaccess file also.
    But except my home page all other pages getting 404 error. Can any one suggest with best solution.

    1. Hello Vasu,

      We would need a little information on what you’re using for your website. If you’re using a application like WordPress, you may need to refresh or remove permalinks or URL-friendly links. Turn it off, and then restore it. The application may need to rebuild the links in the database.

      Please try that first. If you have the same problem then please provide more information on your site and we would happy to look into it further.

      If you have any further questions or comments, please let us know.

      Regards,
      Arnel C.

  4. hello, I have a website that was indexed more than 18,000 pages, components joomsef bought for website optimization, I came up with the option to activate the mod_rewrite module, given that all my pages indexed in Google with index.php , the website does not create a problem for SEO?

    1. Hello Moji,

      If you optimized your site and included the 301 redirects for the change in path, then it should be okay. However, if you didn’t include any 301 re-directs, then Google may assume that you have 2 links (one to old content and one to new) until it is able to determine that that the content has been moved.

      I hope this helps to answer your question, please let us know if you require any further assistance.

      Regards,
      Arnel C.

    1. Hello Guomaodrive,

      Sorry for the problem with the “install IIS URL Rewrite Module”. The main issue here is that we do not have any IIS servers with our hosting (Microsoft Windows-based). You will need to consult with a developer/programmer familiar with this module in order to resolve the issue. Apologies that we can’t give you a direct answer for this particular subject.

      Regards,
      Arnel C.

  5. NOTE!! The htaccess.txt must be renamed to .htaccess. DONT FORGET TO ADD THE . (Period) infront of htaccess. WAS: htaccess.txt TO: .htaccess I forgot the . infornt of the htaccess file name and I looked for hours on why it wasn’t working. and….that was the little thing I got. NO need to do ANYTHING internally to the file. just that simple remane. And I didn’t find the file in my CPanel, I had to use file zilla to get to it. 

  6. Hola, gracias por la publicación, he estado buscando por todos lados una solución, pero hay algo que falta y no me deja, renombre el archivo htaccess.txt a .htaccess, tilde en Usar la reescritura de URLs, mi versión de joomla es 3.2.3 es un servidor apache, php 5.5.21 con el modulo mod_rewrite cargado. Mil gracias por la ayuda!!! 

    1. Hello Pablo,

      Apologies and we only provide support in English. However, if you are unable to change the .htacess file, then it’s most likely a permission issue or the file already exists. You can EDIT the existing file and copy in the text from the .htaccess.txt file if you’re trying to get that code to be active. That would probably the easiest way to handle the issue. If you are hosted with InMotion, provide us the domain name and we can make the change for you.

      Regards,
      Arnel C.

    1. Hello Tom,

      By default, any file with the “.” in front of it is considered a “hidden” file. If you are using the cPanel file manager, then you will need to re-open it and select SHOW HIDDEN FILES. If you have somehow set that screen to not appear, then you will need to open cPanel and select Reset interface options at the very bottom of the screen. Once you are showing the hidden files, you’ll be able to find your .htaccess file.

      Regards,
      Arnel C.

  7. I have the same problem. It removed the index.php from the URLs but after that I get 404 errors of all my pages.

    I have a .htaccess file as well as a htaccess.txt file. 

    The .htaccess file contains these lines

    # Use PHP5.4 Single php.ini as default

    AddHandler application/x-httpd-php54s .php

    RewriteEngine On

    RewriteCond %{HTTP_HOST} !^www.yourfloor.net$ [NC]

    RewriteRule ^(.*)$ https://www.yourfloor.net/$1 [L,R=301]

    How do I rename htaccess.txt to .htacess so that the above codes are also present?

    Thanks

    1. Hello Fredrick,

      You should be able to use the file manager in cPanel to rename the file (you have to set it to show hidden files). You can then edit the .htaccess file and add/remove the code that you wish to add/remove. You can also manage files that are saved on your server.

      I hope that helps to answer your question.

      Regards,
      Arnel C.

  8. I have same problem:

    running from home on ubuntu server 13.10, joomla 3.3.1, with PHP 5.5.3-1ubuntu2.3

    I have done  the htaccess stuff, 000-sites-enabled and i think it could be an issue with apache and modrewrite itself.

    Is there a noobsafe way/doc to figure it out for basic, simple rewrite (removing /index.php?) as i can not get my head around the apache docs 🙁

    1. Hello David,

      I’ve been looking around and the best reference I could find on properly setting mod_rewrite can be found here. Take a look at the comments there as well the provided solutions and see if it doesn’t provide you the information to properly set MOD_REWRITE.

      Regards,
      Arnel C.

  9. Hi

    Thanks, it removed index.php

    but there is a problem that i couldn’t resolve:

    after that, because in all urls were use index.php then it shows 404 error

     for example domain.com/contact couldn’t be found  (because its real address in domain.com/index.php?contact)

    1. Helli Nima,

      To be sure, go ahead and clear your cache and test again. If it is still persistent, make sure you renamed the .htaccess file properly as advised in step 4. It is most often caused by this.

      Kindest Regards,
      Scott M

Was this article helpful? Join the conversation!

Server Madness Sale
Score Big with Savings up to 99% Off

X