Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-23-2009, 08:39 AM   PM User | #1
AmyDiane
New to the CF scene

 
Join Date: Apr 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
AmyDiane is an unknown quantity at this point
Question mod_rewrite html to php

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
AmyDiane is offline   Reply With Quote
Old 04-23-2009, 08:57 AM   PM User | #2
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,678
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
Quote:
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,

Code:
AddHandler application/x-httpd-php .php .html
Hope this would be useful to you.
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Old 04-26-2009, 08:01 PM   PM User | #3
schleppel
Regular Coder

 
Join Date: Oct 2004
Posts: 330
Thanks: 0
Thanked 13 Times in 13 Posts
schleppel is an unknown quantity at this point
To do it with mod_rewrite, try
Code:
Options +FollowSymLinks

# Make sure the .php file exists
RewriteCond %{DOCUMENT_ROOT}/$1php -f
RewriteRule ^(.+\.)html$ /$1php [QSA,L]
schleppel is offline   Reply With Quote
Old 11-03-2010, 10:50 PM   PM User | #4
Ersa
New Coder

 
Join Date: Jun 2010
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Ersa is an unknown quantity at this point
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
Code:
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?
Ersa is offline   Reply With Quote
Old 08-30-2011, 05:29 PM   PM User | #5
devonssmart
New Coder

 
Join Date: Jul 2011
Location: Texas
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
devonssmart is an unknown quantity at this point
Quote:
Originally Posted by Ersa View Post
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
Code:
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 and visit the lighttpd Support Forums if you have questions specific to lighttpd which are not being answered to your satisfaction here on the CodingForums.
__________________
GPS Reviews or GPS Reviews
devonssmart is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:49 AM.


Advertisement
Log in to turn off these ads.