htaccess urlrewriting problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
me666
Forum Commoner
Posts: 87
Joined: Wed Oct 08, 2008 5:04 pm

htaccess urlrewriting problem

Post by me666 »

hi all,
i have a html file i have upgraded to php for use with more functions, but i have php include connecting to the file in around 30-40 files. with this i have written in my .htaccess file the following 3 lines

Code: Select all

RewriteEngine On
RewriteRule ^include/oldfile\.html$ /include/newfile.php 
RewriteRule ^include/oldfile\.html/$ /include/newfile.php
but it still only includes the old html file rather than the new file. is there anything i have done wrong here or another piece of code i could use once? or will i just have to manually edit all my include calls to .php rather than .html?
thanks :)
User avatar
markusn00b
Forum Contributor
Posts: 298
Joined: Sat Oct 20, 2007 2:16 pm
Location: York, England

Re: htaccess urlrewriting problem

Post by markusn00b »

Calls to include() do not make a request to the server - that is why no redirect occurs. You could sym-link it, or you could just not be lazy and include the correct file.

Further more, you're include()ing HTML into PHP?
me666
Forum Commoner
Posts: 87
Joined: Wed Oct 08, 2008 5:04 pm

Re: htaccess urlrewriting problem

Post by me666 »

ok thanks for the reply, i'll just change them manually :)

yes html into php as in the html file i have only my <body> tag so that i can easily change the colours of my whole site by changing that single file, i have created a php colour theme changer though and need the file to be php.

i will go through and change them all, thanks anyway
Post Reply