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.

Website and Server Administration Forum


You are currently viewing our Website and Server Administration Forum as a guest. Please register to participate.
Login



Reply
Old 01-23-2012, 01:48 PM mod rewrite question
Skilled Talker

Posts: 69
Name: Greg
Location: South Carolina
Trades: 0
trying to work on a little mod_rewrite functionality and I am hitting a road block.

www.samplesite.com/index.php is the main index file.

in the htaccess I would like to have something like the below so that if someone specifies www.samplesite.com/sample-product-1 it will evaluate and call the itemdetail script with the right product name which I then translate into an ID and pull from the db.

RewriteRule ^products/([^/\.]+)/?$ itemdetail.php?name=$1 [L]


However when I do that, I end up with issues with the style sheet and other referenced files not being found in the products directory. IF you view source it does not show you that its pulling from products, but if you click on the link in view source, it is referenced there.

So I took the products out and tried to have just
RewriteRule ([^/\.]+)/?$ itemdetail.php?name=$1 [L]

This obviously causes problems as it is always going to call the itemdetail script. How do you tell it to stay on index if nothing is passed?

Thanks
scuts is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-23-2012, 02:00 PM Re: mod rewrite question
vectorialpx's Avatar
Extreme Talker

Posts: 249
Name: octavian
Location: Bucharest
Trades: 0
You need to have in your head
<base href="http://yoursite.com/">
so all links (styles, javascripts, images etc) will be from that address.
__________________
you can
Please login or register to view this content. Registration is FREE
vectorialpx is offline
Reply With Quote
View Public Profile Visit vectorialpx's homepage!
 
Old 01-23-2012, 02:05 PM Re: mod rewrite question
Skilled Talker

Posts: 69
Name: Greg
Location: South Carolina
Trades: 0
Quote:
Originally Posted by vectorialpx View Post
You need to have in your head
<base href="http://yoursite.com/">
so all links (styles, javascripts, images etc) will be from that address.
sometimes I feel so small!!! THank you
scuts is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to mod rewrite question
 

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