Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-31-2009, 06:02 AM   PM User | #1
tokio
New Coder

 
Join Date: Jun 2008
Location: Jupiter
Posts: 49
Thanks: 8
Thanked 0 Times in 0 Posts
tokio is an unknown quantity at this point
Redirecting index.php to index.html

I tried it using .htaccess, but it didnt work. here is the code below.

PHP Code:

RewriteCond 
%{THE_REQUEST} ^GET .*/website.(php|htmlHTTP
RewriteRule 
^(.*)website.(php|html)$ /$[R=301,L
Do anyone have any suggestions for doing this in php? The thing im confused about regarding redirecting a .php file to an .html file, is do i only need to write an .php file, and the contents in it will redirect to index.html, or should both files contain identical information? Thanks.
tokio is offline   Reply With Quote
Old 07-31-2009, 08:42 AM   PM User | #2
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,293
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
I think we need to know why you want to redirect to index.html from index.php. There may be better or other ways to do what you want.
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||
_Aerospace_Eng_ is offline   Reply With Quote
Old 07-31-2009, 03:37 PM   PM User | #3
tokio
New Coder

 
Join Date: Jun 2008
Location: Jupiter
Posts: 49
Thanks: 8
Thanked 0 Times in 0 Posts
tokio is an unknown quantity at this point
Quote:
Originally Posted by _Aerospace_Eng_ View Post
I think we need to know why you want to redirect to index.html from index.php. There may be better or other ways to do what you want.

Sure, i dont like seeing the .php extensions. I want all of my pages to just be in either .html or .com.
tokio is offline   Reply With Quote
Old 07-31-2009, 06:26 PM   PM User | #4
michaelespinosa
New Coder

 
Join Date: Aug 2007
Posts: 69
Thanks: 11
Thanked 2 Times in 2 Posts
michaelespinosa is an unknown quantity at this point
.htaccess should work easily.

Code:
Redirect 301 /index.php http://www.yoursite.com/index.html
michaelespinosa is offline   Reply With Quote
Users who have thanked michaelespinosa for this post:
tokio (07-31-2009)
Old 07-31-2009, 07:03 PM   PM User | #5
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,293
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
Quote:
Originally Posted by tokio View Post
Sure, i dont like seeing the .php extensions. I want all of my pages to just be in either .html or .com.
But you still want to use php in your files? If that is the case then you need to make your server serve up html files as php files.

Read this

http://www.desilva.biz/php/phpinhtml.html

That should work. Now you can use .html but you can still use .php in them. Can I ask why you want this though? I don't see the problem with using .php
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||
_Aerospace_Eng_ is offline   Reply With Quote
Users who have thanked _Aerospace_Eng_ for this post:
tokio (07-31-2009)
Old 07-31-2009, 08:19 PM   PM User | #6
tokio
New Coder

 
Join Date: Jun 2008
Location: Jupiter
Posts: 49
Thanks: 8
Thanked 0 Times in 0 Posts
tokio is an unknown quantity at this point
@ michael: Thanks, but i was looking for more of an automated approach.

@eng: Thanks for that. Good question by the way, its more for marketing purposes, as i think most people visiting a site and dont could would remember a .html url as opposed to a .php.
tokio is offline   Reply With Quote
Old 08-01-2009, 12:46 AM   PM User | #7
zellfaze
New Coder

 
Join Date: Jul 2009
Location: Eastern United States
Posts: 14
Thanks: 0
Thanked 4 Times in 4 Posts
zellfaze is an unknown quantity at this point
That makes complete sense. From a security point of view it is useful too. The less they know about how the site runs the better.
zellfaze is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 +1. The time now is 10:46 AM.


Advertisement
Log in to turn off these ads.