Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
mod rewrite .html to .php with query string
Old 07-15-2008, 09:01 PM mod rewrite .html to .php with query string
Average Talker

Posts: 20
Name: Shane
Trades: 0
Okay, I have at the moment:

PHP Code:
RewriteEngine on
RewriteRule 
^([^/]*)\.html$ $1.php 
Which converts something.html to something.php. However, I want to make it go something.html to parse.php?action=something. I tried:

PHP Code:
RewriteEngine on
Rewrite Rule 
^([^/]*)\.htmlparse.php?action=$
But that doesn't work. I get 404 error saying that something.html can't be found. I have never used mod rewrite before and don't really get these expressions so if someone could help me out I would be very grateful. =)
Demexii is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-16-2008, 09:33 AM Re: mod rewrite .html to .php with query string
Experienced Talker

Posts: 33
Name: Joseph
Trades: 0
You can try this:

Single URL:
Code:
Options +FollowSymLinks
RewriteEngine on

RewriteRule parse-action-(.*)\.html parse.php?action=$1
Example: http://domain.com/parse-action-something.html


Directory Separated URL:
Code:
Options +FollowSymLinks
RewriteEngine on

RewriteRule parse/action/(.*) parse.php?action=$1
Example: http://domain.com/parse/action/something/

or
Comma separated:
Code:
Options +FollowSymLinks
RewriteEngine on

RewriteRule parse,(.*)\.html parse.php?action=$1
Example: http://domain.com/parse,something.html

Good luck!
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
xmsmmgrs is offline
Reply With Quote
View Public Profile Visit xmsmmgrs's homepage!
 
Old 07-17-2008, 02:52 AM Re: mod rewrite .html to .php with query string
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
Your regexp is correct. Did you really wrote "Rewrite Rule" in your .htaccess? Also try adding [L] after the rewrite expression so that this rewrite worked only once.

RewriteRule source destination [L]
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Reply     « Reply to mod rewrite .html to .php with query string
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.13572 seconds with 12 queries