Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.