About removing index.php from the URL structure
Posted: 30 July 2008 10:21 PM   [ Ignore ]  
Summer Student
Total Posts:  9
Joined  02-27-2006

I know many people had posted many threads on the subject already by now. But still, I couldn’t find a solution to override the topic. By now, I’m currently managing 3 Expression Engine powered sites, and would like to have the default index.php removed from them. I’ve checked with my hosting provider, they’re running the following technologies on their server

Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.7a mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server at www.somedomain.com Port 80

and yes they also enabled mod_rewrite for clean permalink (no index.php). So after a few small research on the EE’s wiki, I stumbled upon this article. The include list, as far as I see it, is the most decent and reasonable method to tweak this situation. So here’s what I’ve got so far:

RewriteEngine on
RewriteCond
$1 ^(weblog|member|search|Forum_Name|TemplateGroup_4_Name|TemplateGroup_5_Name|P[0-9]{2,8}) [NC]
RewriteRule
^(.*)$ /index.php/$1 [L]

From the above code, I may conclude that all I have to do is simply putting my group’s name from my template management section. And that is exactly what I did. by going to Templates > Template Management, would reveal all my templates collections. So assuming I have the following template name :

- site* (Indicates master site default page)
- search
- embed (has many others embeddable variables)
- about
- products
- clients
- news
- downloads
- contact
- vacancies

would that imply I only need to tweak my .htacccess file as the following :


RewriteEngine on
RewriteCond
$1 ^(site|search|embed|about|products|clients|news|downloads|contact|vacancies|P[0-9]{2,8}) [NC]
RewriteRule
^(.*)$ /index.php/$1 [L]

After saving the .htaccess, and putting them back in the root folder my public_html, I realized it didn’t do anything. I even trying to type manually on the address bar as per the following :

-http://www.somesite.com/about as replacement for http://www.somesite.com/index.php/about

But it didn’t do anything, hopefully my post won’t get confusing. So anyone with a successful stories in removing the index.php may help me out to solve my problem here. And by the way here’s a screen shoot of my .htaccess and template groups collections, in case anyone wondering what I’ve struggling so far. So, have I missed any further steps here there, or perhaps even have to tweak the .htaccess a little bit more? Anyone with enlightenments are welcomed to help. Many thanks.

Profile
 
 
Posted: 30 July 2008 11:22 PM   [ Ignore ]   [ # 1 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  381
Joined  03-01-2006

That include list method seems overly complicated. All I do is this:

RewriteEngine On
RewriteCond
%{REQUEST_FILENAME} !-f
RewriteCond
%{REQUEST_FILENAME} !-d
RewriteRule
^(.*)$ /index.php/$1 [L]

And then in your system preferences, you need to make sure the ‘Name of your site’s index page’ field at CP Home ›  Admin ›  System Preferences ›  General Configuration is blank.

 Signature 

John Faulds - Tyssen Design | Member of EE Pro Network

Profile
 
 
Posted: 31 July 2008 12:57 AM   [ Ignore ]   [ # 2 ]  
Summer Student
Total Posts:  9
Joined  02-27-2006

Okay I’ve managed to change the “Name of Your Site Index Page” set to blank in the CP Home › Admin › System Preferences › General Configuration. However, as I reloaded the browser, the resulting URL gets a bit strange

- http://www.mydomain.com//news
- http://www.mydomain.com//about
- http://www.mydomain.com//products
- http://www.mydomain.com//clients

etc,

The strange thing is, whenever I tried to click any of them, it reloads nothing except my default index page. And as I typed them manually by hand (http://www.mydomain.com/about) it still gives me the default index page too. As an experimental action, still in the General Configuration page, I tried to replace the “URL to the root directory of your site (This is the directory containing your site index file)” field to http://www.mydomain.com, (previously it was with a trailing slash) but still has no effect occurred. It stills redirect me to the default index page.

Any further idea why? Thanks John.

Profile
 
 
Posted: 31 July 2008 03:21 PM   [ Ignore ]   [ # 3 ]  
Grad Student
Rank
Total Posts:  33
Joined  11-08-2007

Hello,
Everything was working until just recently and now all the pages go to the homepage

mydomain.com/About-Us goes to mydomain.com now

I can view my pages if i manually plug in the url string..
mydomain.com/index.php/About-Us

Ive tried this method in this thread but this didnt work .. It was working before with this method :

RewriteEngine On<br />
RewriteCond $1 ^({exp:query sql=“SELECT group_name FROM exp_template_groups”}{group_name}|{/exp:query}P[0-9]{2,8}) [NC]<br />
RewriteRule ^(.*)$ /index.php/$1 [L]

i would run that in the template section and it would generate my file..


Please help?

thanks1

-Joseph

Profile
 
 
Posted: 31 July 2008 10:37 PM   [ Ignore ]   [ # 4 ]  
Summer Student
Total Posts:  9
Joined  02-27-2006

mydomain.com/About-Us goes to mydomain.com now
I can view my pages if i manually plug in the url string.. mydomain.com/index.php/About-Us

The same thing happened to me too,

RewriteEngine On
RewriteCond
$1 ^({exp:query sql="SELECT group_name FROM exp_template_groups"}{group_name}|{/exp:query}P[0-9]{2,8}) [NC]
RewriteRule
^(.*)$ /index.php/$1 [L]

Haven’t try the above method yet, though just wondering, would the above method work on core EE?

Many Thanks.

Profile
 
 
Posted: 19 August 2008 06:38 PM   [ Ignore ]   [ # 5 ]  
Research Assistant
RankRankRank
Total Posts:  327
Joined  11-05-2006

The same thing happened to me after my hosting company upgraded Apache.  I’ve tried ALL of the mod_rewrite methods and nothing works.

Any ideas!?

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64939 Total Logged-in Users: 56
Total Topics: 81911 Total Anonymous Users: 50
Total Replies: 440324 Total Guests: 290
Total Posts: 522235    
Members ( View Memberlist )