...

View Full Version : mod_rewrite html to php



AmyDiane
04-23-2009, 08:39 AM
I'm new at all this, and need a little help.

My website has static html pages. I would like to add a feed from my blog to a few of those pages. I want to use a php script embedded in my html. If I change the page name from xxxx.html to xxxx.php the feed from my blog is included, but any link to that page is broken. I would like the server to process the php on my html page; I was hoping that I could use mod_rewrite in my .htaccess file to implement that. The GoDaddy (sorry, I told you I was new at this) documentation indicates that mod_rewrite is enabled on linux servers by default. I've been trying to figure this out all day, but can't seem to get it to work. It would be a big help if you could point me in the right direction.

Mahalo

abduraooft
04-23-2009, 08:57 AM
I want to use a php script embedded in my html. If I change the page name from xxxx.html to xxxx.php the feed from my blog is included, but any link to that page is broken. You could treat your html files like your php files by adding a rule in your htaccess file like,


AddHandler application/x-httpd-php .php .html Hope this would be useful to you.

schleppel
04-26-2009, 08:01 PM
To do it with mod_rewrite, try

Options +FollowSymLinks

# Make sure the .php file exists
RewriteCond %{DOCUMENT_ROOT}/$1php -f
RewriteRule ^(.+\.)html$ /$1php [QSA,L]

Ersa
11-03-2010, 10:50 PM
Hello.

I had Apache server and changed to Lighttpd..
I had this functions for mod_rewrite in Apache..
so how can I change them and use them in lighttpd ?

.htaccess


RewriteEngine On
RewriteRule ^index\.html$ ./index.php?mdrw=on
RewriteRule ^manual\.html$ ./index.php?action=manual&mdrw=on
RewriteRule ^([0-9]+)_([0-9]+)_([-0-9]+)\.html$ ./index.php?action=vthread&forum=$1&topic=$2&page=$3&mdrw=on
RewriteRule ^([0-9]+)_([-0-9]+)\.html$ ./index.php?action=vtopic&forum=$1&page=$2&mdrw=on


is it possible?

devonssmart
08-30-2011, 05:29 PM
Hello.

I had Apache server and changed to Lighttpd..
I had this functions for mod_rewrite in Apache..
so how can I change them and use them in lighttpd ?

.htaccess


RewriteEngine On
RewriteRule ^index\.html$ ./index.php?mdrw=on
RewriteRule ^manual\.html$ ./index.php?action=manual&mdrw=on
RewriteRule ^([0-9]+)_([0-9]+)_([-0-9]+)\.html$ ./index.php?action=vthread&forum=$1&topic=$2&page=$3&mdrw=on
RewriteRule ^([0-9]+)_([-0-9]+)\.html$ ./index.php?action=vtopic&forum=$1&page=$2&mdrw=on


is it possible?

My best recommendation would be that you review the lighttpd mod_rewrite documentation (http://redmine.lighttpd.net/wiki/lighttpd/Docs:ModRewrite) and visit the lighttpd Support Forums (http://redmine.lighttpd.net/projects/lighttpd/boards/2) if you have questions specific to lighttpd which are not being answered to your satisfaction here on the CodingForums.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum