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.

SEO Tycoon


You are currently viewing our SEO Tycoon as a guest. Please register to participate.
Login



Freelance Jobs

Reply
I'm trying to rewrite dynamic URL but it doesn’t work for mysterious reason, plz help
Old 01-08-2011, 06:20 PM I'm trying to rewrite dynamic URL but it doesn’t work for mysterious reason, plz help
Junior Talker

Posts: 2
Name: Asher
Trades: 0
Here is the code i'm using in the .htaccess:
Options +FollowSymLinks
RewriteEngine on
RewriteRule product_detail/name/(.*)/ product_detail.php?name=$1
RewriteRule product_detail/name/(.*) product_detail.php?name=$1

what is the problem?
elranas is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-08-2011, 06:25 PM Re: I'm trying to rewrite dynamic URL but it doesn’t work for mysterious reason, plz
Defies a Status

Posts: 1,606
Trades: 0
It doesn't look like the proper syntax and spacing to me. Here is one that I know works and has the proper spacing:

Quote:
RewriteRule ^([0-9]+)/(.*)-([0-9]+)\.html$ myfile.php?cat_id=$1&page=$3 [L,NC]
__________________
Colbyt

Please login or register to view this content. Registration is FREE
colbyt is offline
Reply With Quote
View Public Profile
 
Old 01-08-2011, 06:39 PM Re: I'm trying to rewrite dynamic URL but it doesn’t work for mysterious reason, plz
Average Talker

Posts: 27
Location: Charlotte, NC
Trades: 0
I would suggest being explicit with your target URLs. Also you do not have any flags on your RewriteRules. If you get a match you typically want to use at least an [L,NC] if it's a rewrite and an [R=301,L,NC] or [R=302,L,NC] if its a permanent or temporary redirect, respectively.

For example, if the above RewriteRules exist in the .htaccess in your root folder I would use something like:

Quote:
RewriteRule product_detail/name/(.*)/ http://www.example.com/product_detail.php?name=$1 [L,NC]
RewriteRule product_detail/name/(.*) http://www.example.com/product_detail.php?name=$1 [L,NC]
The [L] flag tells it to break out of the .htaccess and execute the rule. If you omit the [L] flag, Mod_Rewrite will continue to fall thru executing subsequent rules. This allows you to daisy chain rewrite rules. So it continues to fall thru. And since it likely doesn't match another rule later in the .htaccess, it never gets executed.
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
Canonical is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to I'm trying to rewrite dynamic URL but it doesn’t work for mysterious reason, plz help
 

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.60035 seconds with 12 queries