Go Back   HostGator Peer Support Forums > General Discussion > Off-Topic

Notices

Reply
 
Thread Tools
  #1  
Old 05-05-2008, 01:30 PM
GOODY GOODY is offline
Baby Croc
 
Join Date: Mar 2007
Posts: 77
Default Mod_Rewrite

How to do a mod_rewrite so that my php pages will be seen as .html pages?
Reply With Quote
  #2  
Old 05-05-2008, 02:15 PM
GOODY GOODY is offline
Baby Croc
 
Join Date: Mar 2007
Posts: 77
Default Re: Mod_Rewrite

Would it be something like this?:

Code:
 
Options +FollowSymLinks
RewriteEngine on
RewriteRule index.html$ /index.php?
Is this 100% correct and seo compliant?
Reply With Quote
  #3  
Old 05-05-2008, 04:39 PM
GatorZach
HostGator Guest
 
Posts: n/a
Default Re: Mod_Rewrite

I think what you want it to have php code inside of your html pages, that way you don't have to have people see .php. This is possible with this .htaccess code:

Code:
AddHandler application/x-httpd-php5 .htm .html
Reply With Quote
  #4  
Old 05-05-2008, 05:01 PM
GOODY GOODY is offline
Baby Croc
 
Join Date: Mar 2007
Posts: 77
Default Re: Mod_Rewrite

Quote:
Originally Posted by GatorZach View Post
I think what you want it to have php code inside of your html pages, that way you don't have to have people see .php. This is possible with this .htaccess code:

Code:
AddHandler application/x-httpd-php5 .htm .html
I have
Code:
#AddHandler application/x-httpd-php5 .php
in my .htaccess already so I should change it to
Code:
#AddHandler application/x-httpd-php5 .php .htm .html
?
Reply With Quote
  #5  
Old 05-05-2008, 05:12 PM
slapshotw's Avatar
slapshotw slapshotw is offline
Veteran Croc
 
Join Date: Jun 2006
Posts: 5,164
Default Re: Mod_Rewrite

Change it to that, and take off the # from the beginning (the # means it's commented out).

If that breaks your site, use this instead:
Code:
AddHandler application/x-httpd-php5 .php .htm .html
However, that will mean your site isn't php5 compatible.
__________________
Follow me on Twitter! http://twitter.com/mrw
Reply With Quote
  #6  
Old 05-05-2008, 05:33 PM
GOODY GOODY is offline
Baby Croc
 
Join Date: Mar 2007
Posts: 77
Default Re: Mod_Rewrite

Ok Thanks!
Reply With Quote
  #7  
Old 05-12-2008, 04:31 AM
jakeruston jakeruston is offline
Banned User
 
Join Date: Apr 2008
Posts: 71
Default Re: Mod_Rewrite

Does it really matter that they are .php instead of .html files though?
Reply With Quote
  #8  
Old 05-12-2008, 08:56 AM
GOODY GOODY is offline
Baby Croc
 
Join Date: Mar 2007
Posts: 77
Default Re: Mod_Rewrite

Well they say that .html is more seo friendly, search engines follow .html better.
Reply With Quote
  #9  
Old 05-12-2008, 09:05 AM
striddy's Avatar
striddy striddy is offline
Veteran Croc
 
Join Date: Mar 2008
Location: /home/australia/earth
Posts: 4,093
Default Re: Mod_Rewrite

Quote:
Originally Posted by GOODY View Post
Well they say that .html is more seo friendly, search engines follow .html better.
Who is they?
__________________
- David
Reply With Quote
  #10  
Old 05-12-2008, 09:27 AM
GOODY GOODY is offline
Baby Croc
 
Join Date: Mar 2007
Posts: 77
Default Re: Mod_Rewrite

Generally speaking... what I've read. Is it not true?
Reply With Quote
  #11  
Old 05-12-2008, 09:56 AM
striddy's Avatar
striddy striddy is offline
Veteran Croc
 
Join Date: Mar 2008
Location: /home/australia/earth
Posts: 4,093
Default Re: Mod_Rewrite

Not in my experience.
__________________
- David
Reply With Quote
  #12  
Old 05-12-2008, 05:19 PM
GatorJamyn
HostGator Guest
 
Posts: n/a
Default Re: Mod_Rewrite

The search engines that matter (Google, Yahoo, etc) follow php pages just fine. I don't recommend handling .php pages through the .html extension unless you have a serious need to do so; adding the php handler to your .htm(l) pages means more cpu use for your account (since the php handler would be called on basically every page, regardless of whether or not it had php code in it).

They do not deal with dynamic content as well, depending on how it's done. However, the fact that your page ends in .html or .php does not matter if it uses URIs like:

http://website.com/page.php?id=12345...nline=whatever (not engine friendly) vs:


http://website.com/page.php/item_hammer/online/

You get the idea. The page extension is not the problem. Now, you could probably rewrite URLs from the first example to the 2nd, but it's a bit of work to do something like that.
Reply With Quote
  #13  
Old 05-12-2008, 08:35 PM
GOODY GOODY is offline
Baby Croc
 
Join Date: Mar 2007
Posts: 77
Default Re: Mod_Rewrite

Thanks for that tutorial Jamyn.
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -5. The time now is 03:36 PM.