DeveloperCube - .htaccess redirect/mod rewrite
Community management insight at ManagingCommunities.com
Username:    Password:
Remember Me?    
.htaccess redirect/mod rewrite

 
Post new topic   Reply to topic    DeveloperCube Forum Index -> Scripts and Programming
 See a User Guidelines violation? Please contact us.
Author Message

marc

Joined: 29 Jan 2004
Posts: 24

PostPosted: 2/17/2004, 12:01 pm    Post subject: .htaccess redirect/mod rewrite Reply with quote

Im going to be changing about a thousand pages from .html to .php, how can I set all requests to

pagename.html

to go to

pagename.php

I've done it on the eryc forum's with mod rewrite, and it went from .php -> .html instead of vice versa. And i'm not positive if the server this site is sat on supports mod rewrite.

Hopefully there's an easy solution that I am over looking.
_________________
Marc
Sites - Playground | Skateboarding | Extreme Shopping
Back to top

Keith
Moderator

Joined: 28 Jan 2004
Posts: 445
Location: Dublin, Ireland

PostPosted: 2/17/2004, 11:55 pm    Post subject: Reply with quote

Won't the phpinfo file tell you if mo_rewrite is installed? I'm not 100% sure though. You should ask the host anyway Smile

Just did a quick search on google for more info on using mod_rewrite and found this: http://www.webmasterworld.com/forum92/82.htm
_________________
Keith McLaughlin - DeveloperCube Moderator

Web Hosting Directory - Freelance Web Design - Webmaster Resources
Back to top

marc

Joined: 29 Jan 2004
Posts: 24

PostPosted: 2/18/2004, 8:09 pm    Post subject: Reply with quote

I can't seem to get anything to work.

And I need to part with cash to read that topic, don't fancy doing that to be honest.
_________________
Marc
Sites - Playground | Skateboarding | Extreme Shopping
Back to top

Keith
Moderator

Joined: 28 Jan 2004
Posts: 445
Location: Dublin, Ireland

PostPosted: 2/18/2004, 9:37 pm    Post subject: Reply with quote

What ya mean you need to part with cash to read the topic?
_________________
Keith McLaughlin - DeveloperCube Moderator

Web Hosting Directory - Freelance Web Design - Webmaster Resources
Back to top

Josh

Joined: 07 Feb 2003
Posts: 292
Location: New Orleans, LA

PostPosted: 2/19/2004, 12:57 am    Post subject: Reply with quote

Keith wrote:
What ya mean you need to part with cash to read the topic?


I just viewed the article without any problems and I'm not a member there.
_________________
Josh Ulfers
Developer Cube Staff
Back to top

JohnMcK

Joined: 30 Jan 2004
Posts: 35
Location: King of Prussia, PA (USA)

PostPosted: 2/19/2004, 1:58 am    Post subject: Reply with quote

Yeah marc, I can see it too.
_________________
The McKernan Corp
Back to top

Keith
Moderator

Joined: 28 Jan 2004
Posts: 445
Location: Dublin, Ireland

PostPosted: 2/19/2004, 2:17 am    Post subject: Reply with quote

I have saved it if you would like me to send it to you Smile

I used to have problems accessing webmasterworld, but not recently.
_________________
Keith McLaughlin - DeveloperCube Moderator

Web Hosting Directory - Freelance Web Design - Webmaster Resources
Back to top

marc

Joined: 29 Jan 2004
Posts: 24

PostPosted: 2/25/2004, 11:17 am    Post subject: Reply with quote

Any ideas why this wont work

Code:
RewriteEngine on
RewriteBase /
RewriteRule ^(.*)\.html$ $1 [C,E=WasHTML:yes]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [S=1,R=permanent]
RewriteCond %{ENV:WasHTML} ^yes$
RewriteRule ^(.*)$ $1.html


What it should be doing is if someone types somepage.html redirect to somepage.php
If somepage.php doesn't exist, load the somepage.html

I have this working now
Code:
RewriteEngine on
RewriteRule ^(.*)\.html$ /$1.php


What that does is requests for thispage.html loads/redirects to thispage.php

Which is great, but if I haven't got around to changing the page name to .php yet, I need to load the origional .html file, the code above wont do that, it looks for the .php, if it doesn't exist you get an error.

Any ideas ? My head is beginning to hurt.
_________________
Marc
Sites - Playground | Skateboarding | Extreme Shopping
Back to top
Display posts from previous:   
Post new topic   Reply to topic    DeveloperCube Forum Index -> Scripts and Programming All times are GMT
Page 1 of 1
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Links: Programming Forum - Art Schools Online

Network: iFroggy Network Blog - iFroggy Hosting - SportsForums.net - KarateForums.com - YanksBlog.com - phpBBHacks.com - PhotoshopForums.com - Managing Online Forums - ManagingCommunities.com - CommunityAdmins.com - DrGregHouse.com - Bad Boy Blog - SodaRatings.com - Patrick O'Keefe

We Support phpBBHacks.com. Forum Icons by Daz. Privacy Policy. Powered by phpBB © phpBB Group. phpBB SEO.
Copyright © 2003-2009. DeveloperCube, iFroggy Network. All Rights Reserved.

Advertising   Contact   Links   Link To Us   Staff   User Guidelines