remove index.php from urls

Need help with the Administration of your Joomla! site? Pop your questions in here.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
User avatar
davmit
Joomla! Explorer
Joomla! Explorer
Posts: 251
Joined: Sun Nov 26, 2006 7:02 am

remove index.php from urls

Post by davmit » Thu Mar 27, 2008 1:29 pm

Hi friends,
in my joomla site i am using sh404SEF component which has turned all my urls into .html.
but the urls have become http://mysite.com/index.php/route.html
now i want to remove index.php from my urls
is there a way to do this

Thanks,
Davmit
There is always a 1 after every 0. DONT LOOSE HOPE ....KEEP TRYING
Best of Luck
Davmit

User avatar
davmit
Joomla! Explorer
Joomla! Explorer
Posts: 251
Joined: Sun Nov 26, 2006 7:02 am

Re: remove index.php from urls

Post by davmit » Thu Mar 27, 2008 1:40 pm

just an update would be that i tried to go in the component sh404SEF Advanced tab an configure it to remove index.php , it did that but the URLS would give a 404 error
There is always a 1 after every 0. DONT LOOSE HOPE ....KEEP TRYING
Best of Luck
Davmit

jarek
Joomla! Explorer
Joomla! Explorer
Posts: 391
Joined: Fri Apr 28, 2006 7:25 pm
Contact:

Re: remove index.php from urls

Post by jarek » Tue Apr 01, 2008 5:09 pm

Do you have ".htaccess" file inyour root directory?
If not, rename "htaccess" to ".htaccess"

User avatar
davmit
Joomla! Explorer
Joomla! Explorer
Posts: 251
Joined: Sun Nov 26, 2006 7:02 am

Re: remove index.php from urls

Post by davmit » Wed Apr 02, 2008 12:38 pm

yes i have the .htaccess file in the root folder ???
There is always a 1 after every 0. DONT LOOSE HOPE ....KEEP TRYING
Best of Luck
Davmit

User avatar
snadowitz
Joomla! Guru
Joomla! Guru
Posts: 764
Joined: Wed Jan 18, 2006 4:40 am
Contact:

Re: remove index.php from urls

Post by snadowitz » Sat Apr 05, 2008 3:37 pm

I suggest the next step is to post the contents of your .htaccess file here for us a;l to have a look at.

Also - what host do you use?
Snadowitz

Becca800
Joomla! Intern
Joomla! Intern
Posts: 69
Joined: Sat May 03, 2008 8:54 pm

Re: remove index.php from urls

Post by Becca800 » Sun May 04, 2008 3:22 pm

I fugured this out. sh404SEF turns off mod_rewrite for its default use which gives you the same urls but with index.php in them. All you have to do is go to the component section and click on sh404SEF. Then on the right you will see a link for advanced options. When you click on that, click on the config section and there will be new tabs there. Click on advanced. And on the drop down box turn mod_rewrite with .htaccess ON. That is it.

agassem
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Sat Oct 13, 2007 1:49 pm

Re: remove index.php from urls

Post by agassem » Wed Feb 11, 2009 9:29 am

Becca800 wrote:I fugured this out. sh404SEF turns off mod_rewrite for its default use which gives you the same urls but with index.php in them. All you have to do is go to the component section and click on sh404SEF. Then on the right you will see a link for advanced options. When you click on that, click on the config section and there will be new tabs there. Click on advanced. And on the drop down box turn mod_rewrite with .htaccess ON. That is it.
I have installed sh404SEF version 1.0.16_Beta - build_222 - Joomla 1.5x and advanced tap option is not available. Is there way to remove index.php for this sh404SEF version?

Thx, A

User avatar
tusker
Joomla! Ace
Joomla! Ace
Posts: 1075
Joined: Tue Dec 25, 2007 2:15 pm
Location: Baroda - India
Contact:

Re: remove index.php from urls

Post by tusker » Wed Feb 11, 2009 9:34 am

agassem wrote:
Becca800 wrote:I fugured this out. sh404SEF turns off mod_rewrite for its default use which gives you the same urls but with index.php in them. All you have to do is go to the component section and click on sh404SEF. Then on the right you will see a link for advanced options. When you click on that, click on the config section and there will be new tabs there. Click on advanced. And on the drop down box turn mod_rewrite with .htaccess ON. That is it.
I have installed sh404SEF version 1.0.16_Beta - build_222 - Joomla 1.5x and advanced tap option is not available. Is there way to remove index.php for this sh404SEF version?

Thx, A
It should be there on the right side of your screen. Once advanced mode is activated you will see all extra settings including project honeypot antispam tools. Try it, it is good and plugins are available for blog platforms like wordpress and CMSs like joomla and drupal.
ONE WORLD OPEN WORLD - WAR TODAY GIVE PEACE A CHANCE
http://indiavoice.info - India News & Information Portal
http://indiadaily.indiavoice.info - India Daily Infotainment

(Powered by Joomla!)

joomyea
Joomla! Apprentice
Joomla! Apprentice
Posts: 22
Joined: Mon Oct 27, 2008 4:50 am

Re: remove index.php from urls

Post by joomyea » Mon Mar 02, 2009 5:08 am

just have .htaccess file in ur site root
and enable .htaccess instead of index.php or index.php? option in
sh404 configuration->advanced tab->rewriting mode to"with .htaccess (mod_rewrite)"
it simply magically worked for me

akaki
Joomla! Intern
Joomla! Intern
Posts: 51
Joined: Mon Jan 29, 2007 6:15 am

Re: remove index.php from urls

Post by akaki » Tue Mar 10, 2009 9:35 am

Hi,
I've "htaccess.txt" file in my root directory. But when I go to change it to ".htaccess", the getting an arror: "You must type a file name".

User avatar
tusker
Joomla! Ace
Joomla! Ace
Posts: 1075
Joined: Tue Dec 25, 2007 2:15 pm
Location: Baroda - India
Contact:

Re: remove index.php from urls

Post by tusker » Tue Mar 10, 2009 4:10 pm

akaki wrote:Hi,
I've "htaccess.txt" file in my root directory. But when I go to change it to ".htaccess", the getting an arror: "You must type a file name".
Ask your host about the problem may be .htaccess extension is not allowed. .htaccess is like .jpg and .gif it is an extension not a file name so remember to put a . (dot) before htaccess when you rename your htaccess.txt file.

It should be like this: .htaccess

It is better to delete htaccess.txt and upload another .htaccess instead of renaming. In your case it may work.
ONE WORLD OPEN WORLD - WAR TODAY GIVE PEACE A CHANCE
http://indiavoice.info - India News & Information Portal
http://indiadaily.indiavoice.info - India Daily Infotainment

(Powered by Joomla!)

287d
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 182
Joined: Mon Jan 05, 2009 4:09 am

Re: remove index.php from urls

Post by 287d » Thu May 28, 2009 2:13 pm

Hi, I have the same problems, but can't find an advanced tab.

Under:
Components > sh404sef > configuration
I only have the following tabs:

Main, Plugins, Languages, By Component, Meta/SEO, Security and 404 page.


Also, my flash files don't show up anymore, which are placed via modules. And my logo - inserted in the actual template (custom template) does not show up when sh404sef is enabled... Looking for an answer to this - is it just because the urls are re-written?

Many Thanks.

User avatar
tusker
Joomla! Ace
Joomla! Ace
Posts: 1075
Joined: Tue Dec 25, 2007 2:15 pm
Location: Baroda - India
Contact:

Re: remove index.php from urls

Post by tusker » Thu May 28, 2009 7:05 pm

287d wrote:Hi, I have the same problems, but can't find an advanced tab.
Click > component > sh404sef in joomla admin's top menu.

On the right hand side there is a setting tab in blue message bar called show the advanced settings. click that and wooohaa... the advanced settings will be there.
ONE WORLD OPEN WORLD - WAR TODAY GIVE PEACE A CHANCE
http://indiavoice.info - India News & Information Portal
http://indiadaily.indiavoice.info - India Daily Infotainment

(Powered by Joomla!)

Lizbit
Joomla! Intern
Joomla! Intern
Posts: 58
Joined: Wed Mar 25, 2009 7:26 pm

Re: remove index.php from urls

Post by Lizbit » Fri Jul 03, 2009 6:28 pm

I have installed the sh404sef as well, and renamed my htaccess file to .htaccess It is configured to "without .htaccess" in the advanced tab.

I'm not excited about the index.php appearing in all my URLs and would like to undo (deactivate) the sh404sef. When I do so, it asks if I want to clear my cache, and if so, I will lose all my records. I hit 'cancel' and saved the change without clearing cache. In doing so, I get the 500 error. I put it back to active.

What must I do to deactive this sh404? Will I need to clear cache? In doing so, does it delete my articles (I get a warning that 71 records will be deleted). This is a new site, just launched. I do have time in it, but nothing of urgency.

Please provide instructions to deactivate - and what I have to 'change back' to make this site work the way it did before. Thank you!

User avatar
tusker
Joomla! Ace
Joomla! Ace
Posts: 1075
Joined: Tue Dec 25, 2007 2:15 pm
Location: Baroda - India
Contact:

Re: remove index.php from urls

Post by tusker » Sat Jul 04, 2009 8:48 pm

use "with .htaccess" in the advanced settings tab and you get urls like this:

http://yoursite.com/section/category/

If you want it with index.php use setting "without .htaccess" and you get exactly what you want with index.php in yor urls.

It is okey to clear cache if you want to and than can disable sh404sef from the advanced setting panel.
ONE WORLD OPEN WORLD - WAR TODAY GIVE PEACE A CHANCE
http://indiavoice.info - India News & Information Portal
http://indiadaily.indiavoice.info - India Daily Infotainment

(Powered by Joomla!)

shawoody
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Sun Jul 19, 2009 8:22 am

Re: remove index.php from urls

Post by shawoody » Sun Jul 19, 2009 3:54 pm

Ok, so I installed sh404SEH. I went to configuration, went to the the advanced tab and set Rewriting Mode to "with .htaccess (mod_rewrite)."

However, the "index.php/" is still showing up in all of my page URLs.

Is there anything I should add to my .htaccess file? What should I do? I cleared the cache as I was prompted to.

I have Joomla version 1.5.12

Thanks for your help!

User avatar
tusker
Joomla! Ace
Joomla! Ace
Posts: 1075
Joined: Tue Dec 25, 2007 2:15 pm
Location: Baroda - India
Contact:

Re: remove index.php from urls

Post by tusker » Mon Jul 20, 2009 8:57 am

delete sh404sef as well as joomla's cache along with your web browsers cache. :) I know it is difficult sometimes..
ONE WORLD OPEN WORLD - WAR TODAY GIVE PEACE A CHANCE
http://indiavoice.info - India News & Information Portal
http://indiadaily.indiavoice.info - India Daily Infotainment

(Powered by Joomla!)

shawoody
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Sun Jul 19, 2009 8:22 am

Re: remove index.php from urls

Post by shawoody » Mon Jul 20, 2009 11:19 pm

tusker wrote:delete sh404sef as well as joomla's cache along with your web browsers cache. :) I know it is difficult sometimes..
Why would I delete sh404sef? Don't I need that to remove the "index.php" from my URLs?

User avatar
tusker
Joomla! Ace
Joomla! Ace
Posts: 1075
Joined: Tue Dec 25, 2007 2:15 pm
Location: Baroda - India
Contact:

Re: remove index.php from urls

Post by tusker » Thu Jul 23, 2009 1:48 pm

shawoody wrote:
tusker wrote:delete sh404sef as well as joomla's cache along with your web browsers cache. :) I know it is difficult sometimes..
Why would I delete sh404sef? Don't I need that to remove the "index.php" from my URLs?
Delete sh404sef's URL CACHE
ONE WORLD OPEN WORLD - WAR TODAY GIVE PEACE A CHANCE
http://indiavoice.info - India News & Information Portal
http://indiadaily.indiavoice.info - India Daily Infotainment

(Powered by Joomla!)

dubart
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Sun Apr 19, 2009 5:41 am

Re: remove index.php from urls

Post by dubart » Tue Oct 27, 2009 8:45 am

Hi guys
I have the following problem:
I have installed the component sh404 (version 1.0.11_Beta- build 147 - joomla 1.5.x - on Joomla 1.5.14 ( i had the same problem on older versions as well))

then I have activated the advanced configuration options.
then I have tried all of the three options :
in the advanced tab:
" without .htaccess (index.php?) "
" without .htaccess (index.php) "
" with .htaccess (mod_rewrite) "

the first two works but when I want to exclude the "index.php / indexphp? " from my URL I get the "not found" ( after I delete the cache of the component) - not 404 ?

Can anyone help me having my URL's without index.php or what so ever

naimless
Joomla! Apprentice
Joomla! Apprentice
Posts: 14
Joined: Wed Nov 25, 2009 8:48 am

Re: remove index.php from urls

Post by naimless » Wed Nov 25, 2009 8:53 am

Removing index.php has caused a problem that sub-directories/folders within the joomla directory are inaccessible.

E.g., I have a mediawiki installation under http://www.example.com/wiki

This is now inaccessible, presumably because the Joomla sh404SEF component tries to parse all URLs without an index.php into Joomla, when it should actually be taking you straight to the sub-directory.

Any ideas on how to fix this? Is there an .htaccess hack that would do the trick?

Many thanks!

[Sorry, didn't realise this was a Joomla 1.0 thread but it seemed the most relevant to post under.]

PcqGy8pL
Joomla! Apprentice
Joomla! Apprentice
Posts: 12
Joined: Sat Apr 19, 2008 9:20 am

Re: remove index.php from urls

Post by PcqGy8pL » Sat Feb 27, 2010 1:37 am

This is caused if you turn ON search-friendly URLs without doing anything to .htaccess

It causes www.your-domain.com/joomla_page.html

to turn into

www.your-domain.com/index.php/joomla_page

User avatar
Tangeray
Joomla! Intern
Joomla! Intern
Posts: 51
Joined: Thu Jan 01, 2009 7:08 am
Contact:

Re: remove index.php from urls

Post by Tangeray » Fri Mar 05, 2010 4:00 am

What are the contents of the .htaccess file.

I did a search on .htaccess so I sort of understand what type of file this is, but does anyone have a proper working code that I can post to my.htaccess file?

Thanks!
10 years ago I hired someone to create a site in Joomla......

I need help to make the world a better place.

User avatar
davmit
Joomla! Explorer
Joomla! Explorer
Posts: 251
Joined: Sun Nov 26, 2006 7:02 am

Re: remove index.php from urls

Post by davmit » Sat Mar 06, 2010 3:49 am

hi friends,

i think i must have solved it.
Basically i did a version upgrade and it did solve my issue.
You can try that too.
There is always a 1 after every 0. DONT LOOSE HOPE ....KEEP TRYING
Best of Luck
Davmit

User avatar
Tangeray
Joomla! Intern
Joomla! Intern
Posts: 51
Joined: Thu Jan 01, 2009 7:08 am
Contact:

Re: remove index.php from urls

Post by Tangeray » Tue Mar 23, 2010 1:36 am

I had to change the .httacess file, which worked but a new problem came up, which I can't remeber now. I will re-post once I get into it again.

acarpov
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Wed Jan 21, 2009 5:15 pm

Re: remove index.php from urls

Post by acarpov » Tue Aug 03, 2010 7:05 pm

i had this problem for ever
i'm hosting with godaddy , i changed to .htaccess and put to use apache mod_rewrite

my home page is ok, when i start going to different tabs it shows internal server error it removes index.php - bt gives internal server error

I talked to godaddy hosting guy and he says that it doesnt do rewrite but does a redirect that is why it is internal error - so something in .htaccess file is wrong

Please help me out

here is the code

##
# @version $Id: htaccess.txt 13415 2009-11-03 15:53:25Z ian $
# @package Joomla
# @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
# @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
# Joomla! is Free Software
##


#####################################################
# READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE
#
# The line just below this section: 'Options +FollowSymLinks' may cause problems
# with some server configurations. It is required for use of mod_rewrite, but may already
# be set by your server administrator in a way that dissallows changing it in
# your .htaccess file. If using it causes your server to error out, comment it out (add # to
# beginning of line), reload your site in your browser and test your sef url's. If they work,
# it has been set by your server administrator and you do not need it set here.
#
#####################################################

## Can be commented out if causes errors, see notes above.
Options +FollowSymLinks

#
# mod_rewrite in use

RewriteEngine On

########## Begin - Rewrite rules to block out some common exploits
## If you experience problems on your site block out the operations listed below
## This attempts to block the most common type of exploit `attempts` to Joomla!
#
## Deny access to extension xml files (uncomment out to activate)
#<Files ~ "\.xml$">
#Order allow,deny
#Deny from all
#Satisfy all
#</Files>
## End of deny access to extension xml files
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
# Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
# Block out any script that includes a <script> tag in URL
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Send all blocked request to homepage with 403 Forbidden error!
RewriteRule ^(.*)$ index.php [F,L]
#
########## End - Rewrite rules to block out some common exploits

# Uncomment following line if your webserver's URL
# is not directly related to physical file paths.
# Update Your Joomla! Directory (just / for root)

# RewriteBase /


########## Begin - Joomla! core SEF Section
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
#
########## End - Joomla! core SEF Section

User avatar
snadowitz
Joomla! Guru
Joomla! Guru
Posts: 764
Joined: Wed Jan 18, 2006 4:40 am
Contact:

Re: remove index.php from urls

Post by snadowitz » Sat Aug 07, 2010 5:17 am

HI - I use godaddy for a few sites - some of which have to use the Windows hosting package. On the Linux hosting package rewrite worked fine if you follow the rules and rename your htaccess.txt file to .htaccess but in order to get it working on the windows package I had to include a little config file called web.config with the following contents.

<configuration>
<system.webServer>
<httpErrors errorMode="detailed"/>
<defaultDocument>
<!-- Set the default document -->
<files>
<remove value="index.php" />
<add value="index.php" />
</files>
</defaultDocument>
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAny">
<add input="{QUERY_STRING}" pattern="mosConfig_[a-zA-Z_]{1,21}(=|\%3D)" ignoreCase="false" />
<add input="{QUERY_STRING}" pattern="base64_encode.*\(.*\)" ignoreCase="false" />
<add input="{QUERY_STRING}" pattern="(\<|%3C).*script.*(\>|%3E)" />
<add input="{QUERY_STRING}" pattern="GLOBALS(=|\[|\%[0-9A-Z]{0,2})" ignoreCase="false" />
<add input="{QUERY_STRING}" pattern="_REQUEST(=|\[|\%[0-9A-Z]{0,2})" ignoreCase="false" />
</conditions>
<action type="CustomResponse" url="index.php" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
</rule>
<rule name="Imported Rule 2">
<match url="(.*)" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" pattern="" ignoreCase="false" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" pattern="" ignoreCase="false" />
<add input="{URL}" negate="true" pattern="^/index.php" ignoreCase="false" />
<add input="{URL}" pattern="(/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

I also have htaccess.txt with the following contents:-

##
# @version $Id: htaccess.txt 14401 2010-01-26 14:10:00Z louis $
# @package Joomla
# @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
# @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
# Joomla! is Free Software
##


#####################################################
# READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE
#
# The line just below this section: 'Options +FollowSymLinks' may cause problems
# with some server configurations. It is required for use of mod_rewrite, but may already
# be set by your server administrator in a way that dissallows changing it in
# your .htaccess file. If using it causes your server to error out, comment it out (add # to
# beginning of line), reload your site in your browser and test your sef url's. If they work,
# it has been set by your server administrator and you do not need it set here.
#
#####################################################

## Can be commented out if causes errors, see notes above.
Options +FollowSymLinks

#
# mod_rewrite in use

RewriteEngine On

########## Begin - Rewrite rules to block out some common exploits
## If you experience problems on your site block out the operations listed below
## This attempts to block the most common type of exploit `attempts` to Joomla!
#
## Deny access to extension xml files (uncomment out to activate)
#<Files ~ "\.xml$">
#Order allow,deny
#Deny from all
#Satisfy all
#</Files>
## End of deny access to extension xml files
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
# Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
# Block out any script that includes a <script> tag in URL
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Send all blocked request to homepage with 403 Forbidden error!
RewriteRule ^(.*)$ index.php [F,L]
#
########## End - Rewrite rules to block out some common exploits

# Uncomment following line if your webserver's URL
# is not directly related to physical file paths.
# Update Your Joomla! Directory (just / for root)

# RewriteBase /


########## Begin - Joomla! core SEF Section
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
#
########## End - Joomla! core SEF Section
Snadowitz

spikesantee
Joomla! Apprentice
Joomla! Apprentice
Posts: 17
Joined: Sat Dec 29, 2007 1:24 pm

Re: remove index.php from urls

Post by spikesantee » Mon Aug 09, 2010 5:27 pm

Maybe everyone figured this out by now but in sh404SEF under the Advanced Tab in Configuration, you will find Advanced Component Configuration. Look for Rewrite Mode. It must be set to "with .htaccess (mod_rewrite)"

paulbar
Joomla! Apprentice
Joomla! Apprentice
Posts: 25
Joined: Mon Dec 08, 2008 6:08 pm

Re: remove index.php from urls

Post by paulbar » Mon Oct 04, 2010 9:35 am

snadowitz wrote:HI - I use godaddy for a few sites - some of which have to use the Windows hosting package. On the Linux hosting package rewrite worked fine if you follow the rules and rename your htaccess.txt file to .htaccess but in order to get it working on the windows package I had to include a little config file called web.config with the following contents.

<configuration>
<system.webServer>
<httpErrors errorMode="detailed"/>
<defaultDocument>
<!-- Set the default document -->
<files>
<remove value="index.php" />
<add value="index.php" />
</files>
</defaultDocument>
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAny">
<add input="{QUERY_STRING}" pattern="mosConfig_[a-zA-Z_]{1,21}(=|\%3D)" ignoreCase="false" />
<add input="{QUERY_STRING}" pattern="base64_encode.*\(.*\)" ignoreCase="false" />
<add input="{QUERY_STRING}" pattern="(\<|%3C).*script.*(\>|%3E)" />
<add input="{QUERY_STRING}" pattern="GLOBALS(=|\[|\%[0-9A-Z]{0,2})" ignoreCase="false" />
<add input="{QUERY_STRING}" pattern="_REQUEST(=|\[|\%[0-9A-Z]{0,2})" ignoreCase="false" />
</conditions>
<action type="CustomResponse" url="index.php" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
</rule>
<rule name="Imported Rule 2">
<match url="(.*)" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" pattern="" ignoreCase="false" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" pattern="" ignoreCase="false" />
<add input="{URL}" negate="true" pattern="^/index.php" ignoreCase="false" />
<add input="{URL}" pattern="(/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

I also have htaccess.txt with the following contents:-

##
# @version $Id: htaccess.txt 14401 2010-01-26 14:10:00Z louis $
# @package Joomla
# @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
# @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
# Joomla! is Free Software
##


#####################################################
# READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE
#
# The line just below this section: 'Options +FollowSymLinks' may cause problems
# with some server configurations. It is required for use of mod_rewrite, but may already
# be set by your server administrator in a way that dissallows changing it in
# your .htaccess file. If using it causes your server to error out, comment it out (add # to
# beginning of line), reload your site in your browser and test your sef url's. If they work,
# it has been set by your server administrator and you do not need it set here.
#
#####################################################

## Can be commented out if causes errors, see notes above.
Options +FollowSymLinks

#
# mod_rewrite in use

RewriteEngine On

########## Begin - Rewrite rules to block out some common exploits
## If you experience problems on your site block out the operations listed below
## This attempts to block the most common type of exploit `attempts` to Joomla!
#
## Deny access to extension xml files (uncomment out to activate)
#<Files ~ "\.xml$">
#Order allow,deny
#Deny from all
#Satisfy all
#</Files>
## End of deny access to extension xml files
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
# Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
# Block out any script that includes a <script> tag in URL
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Send all blocked request to homepage with 403 Forbidden error!
RewriteRule ^(.*)$ index.php [F,L]
#
########## End - Rewrite rules to block out some common exploits

# Uncomment following line if your webserver's URL
# is not directly related to physical file paths.
# Update Your Joomla! Directory (just / for root)

# RewriteBase /


########## Begin - Joomla! core SEF Section
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
#
########## End - Joomla! core SEF Section
can you tell me if the config file is a php file or part of the .htaccess, if its a php file does it go in the root, I am using Hostgator and when I turn on mod_write I get errors, I can only get the site working with /index.php

israrkazmi
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Sat Feb 26, 2011 3:14 pm

Re: remove index.php from urls

Post by israrkazmi » Sat Feb 26, 2011 3:21 pm

Hi guys,

I have found the way to get it done in seconds in Joomla 1.5 (Stable Release)

Question was: How to Remove Index.php from URLs in Joomla CMS.

Answer:
Step 1. change the htaccess.txt to .htaccess from the directory where Joomla CMS is installed.
Step 2. Go to Site>Control Panel
Under the tab of "Server" change the settings of "Use Apache mod_rewrite" from "No" to "Yes".

Enjoy!!!! :)

Regards,
i


Locked

Return to “Administration - 1.0.x”