Memorial Day
Support will be closed on Monday, May 28th, 2012 to enjoy Memorial Day with our friends and families.
This thread is a discussion for the wiki article: Remove index.php From URLs
   
4 of 4
4
Remove index.php From URLs
Posted: 30 November 2010 07:04 PM   [ Ignore ]   [ # 55 ]  
Grad Student
Rank
Total Posts:  58
Joined  04-08-2008

Note: you’ll need to remove the index.php from admin/system preferences/system configuration/url to the root directory of your site.

Note: you’ll need to remove the index.php from Admin > System Preferences > General Configuration > Name of your site’s index page.

I am struggling to remove index.php from my url. Can someone explain the first note above? Am I supposed to remove the file index.php from the server or move it somewhere?

On the second note, can someone confirm that I am supposed to leave “Name of your site’s index page” blank.

Or are these two notes saying the same thing?

I’m confused.

Profile
 
 
Posted: 01 December 2010 07:52 AM   [ Ignore ]   [ # 56 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  257
Joined  01-30-2007

No, when you go into the control panel to the ‘General Configuration’ screen under the ‘Admin’ tab, there are two different fields:

1) ‘Name of you site’s index page’
2) ‘URL to the root directory of your site’

The first needs to be blank, i.e. you remove the ‘index.php’ string that would otherwise be there.
The second is typically your domain name, e.g. ‘http://www.mysite.com/’, you need to make sure there is no ‘index.php’ appended to the end of that.

You don’t need to physically (so to speak) remove the index.php from the server at all. It’s all about configuring things right in the control panel.

Hope that helps.

 Signature 

BridgingUnit (EE Pro) | EE Addons | Twitter: MarmaladeToday

Profile
 
 
Posted: 01 December 2010 11:03 AM   [ Ignore ]   [ # 57 ]  
Grad Student
Rank
Total Posts:  58
Joined  04-08-2008

@BridgingUnit - thanks that clears up a few things. I had already done both of those and no joy.

Can someone confirm that this is what should happen when I have .htaccess configured correctly:

http://mysite.com/index.php/who/history is the url before removing index.php

After mod_rewrite:

http://mysite.com/who/history should work and my nav should link to http://mysite.com/who/history.

During development, my site is actually at http://mysite.com/~mysite/index.php .

Is the ~mysite causing .htaccess to not rewrite the url?

My .htaccess file:

RewriteEngine on 
RewriteCond 
$^(weblog|member|search|main|who|news|P[0-9]{2,8}[NC] 
RewriteRule 
^(.*)$ /index.php/$1 [L] 
Profile
 
 
Posted: 01 December 2010 12:49 PM   [ Ignore ]   [ # 58 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  257
Joined  01-30-2007

Try

RewriteEngine on 
RewriteCond 
$^(weblog|member|search|main|who|news|P[0-9]{2,8}[NC] 
RewriteRule 
^(.*)$ /~mysite/index.php/$1 [L] 

And remember to update that later when you go live.

Alternatively, update the control panel so that it points to ‘http://mysite.com/~mysite/’ instead of ‘http://mysite.com/’ and see how that goes.

Of course it could be that you’re on one of those server configurations that needs things slightly differently, in which case try

RewriteEngine on 
RewriteCond 
$^(weblog|member|search|main|who|news|P[0-9]{2,8}[NC] 
RewriteRule 
^(.*)$ /~mysite/index.php?/$1 [L] 
 Signature 

BridgingUnit (EE Pro) | EE Addons | Twitter: MarmaladeToday

Profile
 
 
Posted: 01 December 2010 03:16 PM   [ Ignore ]   [ # 59 ]  
Grad Student
Rank
Total Posts:  58
Joined  04-08-2008
RewriteRule ^(.*)$ /~mysite/index.php?/$1 [L] 

Had to do both things above to get it to work. Thanks a million!

Profile
 
 
Posted: 01 December 2010 03:39 PM   [ Ignore ]   [ # 60 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  257
Joined  01-30-2007

No problem. Glad it all worked out.

 Signature 

BridgingUnit (EE Pro) | EE Addons | Twitter: MarmaladeToday

Profile
 
 
Posted: 13 December 2010 06:45 PM   [ Ignore ]   [ # 61 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  260
Joined  01-22-2007

Hi Guys,

I don’t have an .htaccess file and I’ve never created one in my life so don’t know where to begin!

However, I need to create one to be able to use NSM’s .htaccess Generator add-on. I’m hosting with EngineHosting.

Could any one give me an idea as to what I need to add in the .htaccess file to begin with so I can upload it to my server and then get NSM’s add-on up and running.

Many thanks,
Euan

 Signature 

euanross.com    @euanross

Profile
 
 
Posted: 01 February 2011 06:28 PM   [ Ignore ]   [ # 62 ]  
Grad Student
Rank
Total Posts:  33
Joined  01-05-2010

Hey EE Community,

I’m about to launch my first EE site but I’m having an issue after removing the index.php from the URL, I followed both this thread and the wiki and I was successful in doing so. The issue I’m having is I have a template group called “games” that isn’t under the default “template” group. So when I click on the link that should go to mydomain/games/newgame it just stays on the page mydomain/games but shows mydomain/games/newgame as the URL. What am I doing wrong, and thank you for any help or direction you guys (or gals) can give smile

Profile
 
 
Posted: 03 February 2011 10:47 AM   [ Ignore ]   [ # 63 ]  
Summer Student
Total Posts:  1
Joined  02-03-2011

I have tried all the suggestions in this thread for Htaccess to remove index.php from Code Igniter URL.
This rewrite rules removes index.php from URL but does not display under Secure URL.
for example:
http://www.mysite.com/CodeIg/MyController —Works perfect

https://www.mysite.com/CodeIg/index.php/MyController —Works perfect

    But

https://www.mysite.com/CodeIg/MyController —Does not Work at all. It gives page not found server error.

Then I tried adding the htaccess rules in Virtual host file…
Now the Screen get displayed but without any css, js and Images included in the page.

All these folder like css, images and JS are in application directory.

Does anyone know why this problem is coming?

REply to post would be appreciated a lot….


Thanks

Profile
 
 
Posted: 21 February 2012 11:35 AM   [ Ignore ]   [ # 64 ]  
Summer Student
Total Posts:  2
Joined  08-18-2011

I am having trouble in removing the “index.php” from the urls and replacing it by the site name. Here are the details:
URL of the website root: http://pinto.vet.uga.edu/
Folder path to the root: /var/www/

I created a .htaccess file in the folder: /var/www/ (I dont know if this is the right place to put it. If not, where do I place the .htaccess file)
Placed this content there:

RewriteEngine On
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L] 

Then I went to the admin EE control panel : Admin -> General Configuration, and changed the default “Name of your site’s index page” from “index.php” to say “hospital”.

For example, I want the link http://pinto.vet.uga.edu/index.php/ecc/ to look like http://pinto.vet.uga.edu/hospital/ecc/ Curre.ntly, I get the following:

————————————
Not Found
The requested URL /hospital/ecc was not found on this server.
Apache/2.2.17 (Ubuntu) Server at pinto.vet.uga.edu Port 80
————————————

I use MSM and I have multiple sites apart from “hospital” in the server.

I have also tried different other versions of the .htaccess file, nothing seems to work. Any help in this matter would be appreciated.

Profile
 
 
Posted: 20 March 2012 06:42 AM   [ Ignore ]   [ # 65 ]  
Summer Student
Total Posts:  3
Joined  03-20-2012

Hello Friends, Today i was working on one project in which I have to remove index.php from URL because example.com/index.php and example.com/ both are same but technically google consider it different URLs, There is one other method by which we can tell google about one best URL which is canonical tag. But I want to do it via URL rewriting and remove index.php from URL means when anyone enters it redirects to example.com/ , I have searched alot and finally I found it So i thought it would be great if I share it on this site, So it can be helpful to someone.

Profile
 
 
   
4 of 4
4