Jump to content

mod rewrite filetype


Dragen

Recommended Posts

okay.. I know this is simple to do, but I just can't figure it out.

I'm trying to mod-rewrite my .php file extensions to .html, or anything for that matter.

I've seen examples so many time, but I just can't find any now I'm wanting them :P

 

Can anyone point me in the right direction for a mod re-write to change file extensions in the url?

thanks

Link to comment
https://forums.phpfreaks.com/topic/66901-mod-rewrite-filetype/
Share on other sites

Okay.. what I've got is this:

RewriteEngine on
RewriteRule ^([a-z]+).html$ .php

which will get any .hml file from the url.. such as

http://www.mydomain.com/index.html

and transfer it to:

http://www.mydomain.com/.php

 

Obviously not quite right... how do I get it to keep the page name (i.e 'index') so that I can use it for the rewrite?

Link to comment
https://forums.phpfreaks.com/topic/66901-mod-rewrite-filetype/#findComment-335405
Share on other sites

thanks!

I've just been searching more and came up with this, which seems to work:

RewriteEngine on
RewriteRule ^([a-z0-9]+).html$ $1.php

 

what does the following snippets of code do?

!-f
!-d
$1

I don't know what the $1 does, but it seemed to work...

thanks

Link to comment
https://forums.phpfreaks.com/topic/66901-mod-rewrite-filetype/#findComment-335414
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.