|
| Author |
Message |
marc
Joined: 29 Jan 2004
Posts: 24
|
Posted: 2/17/2004, 12:01 pm Post subject: .htaccess redirect/mod rewrite |
|
|
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
|
|
| Back to top |
|
 |
marc
Joined: 29 Jan 2004
Posts: 24
|
Posted: 2/18/2004, 8:09 pm Post subject: |
|
|
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
|
|
| Back to top |
|
 |
Josh
Joined: 07 Feb 2003
Posts: 292
Location: New Orleans, LA
|
Posted: 2/19/2004, 12:57 am Post subject: |
|
|
| 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)
|
Posted: 2/19/2004, 1:58 am Post subject: |
|
|
Yeah marc, I can see it too. _________________ The McKernan Corp |
|
| Back to top |
|
 |
Keith
Moderator
Joined: 28 Jan 2004
Posts: 445
Location: Dublin, Ireland
|
|
| Back to top |
|
 |
marc
Joined: 29 Jan 2004
Posts: 24
|
Posted: 2/25/2004, 11:17 am Post subject: |
|
|
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 |
|
 |
|