Go Back   CodingForums.com > :: Server side development > PHP

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 08-26-2006, 02:57 AM   PM User | #1
JayStang
Regular Coder

 
Join Date: Jan 2006
Posts: 116
Thanks: 0
Thanked 0 Times in 0 Posts
JayStang is an unknown quantity at this point
mod_rewrite relative paths issue

Hey guys,
I wasn't sure if this should be in the php forums or html/css.

I'm using mod_rewrite to create some fake directories. Basically i run a CMS so all of my sites are dynamic. The way i use to do everything was just passing url variables... example... index.php?page=about

Now i'm using the mod_rewrite so that i can specify more like index.php/about

my problem is its throwing off all my relative paths for images and stylesheets. i thought i would just be able to reference in by the root...
example: insead of images/test.jpg i figured i could do /images/test.jpg and everything would be ok....

well i was wrong.. for some reason it doesn't want to reference to the root.... and even worse... i can get it to work it i add "../" in front of everything (not that i really want to) but when i do that say i add a second directory (index.php/about/sub) then i would need a "../../" to get that page to work... any thoughts?

thanks!
JayStang is offline   Reply With Quote
Old 08-26-2006, 04:25 AM   PM User | #2
JayStang
Regular Coder

 
Join Date: Jan 2006
Posts: 116
Thanks: 0
Thanked 0 Times in 0 Posts
JayStang is an unknown quantity at this point
nevermind this thread... stupid mistake on my part... i forgot that i wasn't in the root directory.... i just had it in a folder on my server for testing.
JayStang is offline   Reply With Quote
Old 08-26-2006, 05:42 AM   PM User | #3
musher
Regular Coder

 
musher's Avatar
 
Join Date: Jan 2005
Location: Minnesota
Posts: 203
Thanks: 0
Thanked 0 Times in 0 Posts
musher is an unknown quantity at this point
Hey JayStang or any one else I trying to do the same thing
Code:
Basically i run a CMS so all of my sites are dynamic. The way i use to do everything was just passing url variables... example... index.php?page=about
my example is a bit different

/index.php?section=About Us&subsection=Web Philosophy
which shows up as
index.php?section=About%20Us&subsection=Web%20Philosophy

I tried to set things up to use mod-rewrite the other day couldn't get it to work. I created a .htaccess file uploaded to httpdocs folder (here's what I put in the file

PHP Code:
Options +FollowSymLinks

RewriteEngine on

RewriteRule 
^home/?$                     /index.php?section=Home&subsection=Home                    [L]
RewriteRule ^home/site-map/?$            /index.php?section=Home&subsection=Site%20Map              [L]
RewriteRule ^about-us/?$                 /index.php?section=About%20Us&subsection=About%20Us        [L]
RewriteRule ^about-us/web-philosophy/?$  /index.php?section=About%20Us&subsection=Web%20Philosophy  [L]
RewriteRule ^about-us/whats-a-sms/?$     /index.php?section=About%20Us&subsection=Whats%20an%20SMS  [L]
RewriteRule ^about-us/blog/?$            /index.php?section=About%20Us&subsection=Blog              [L
any one see anything wrong with how i set it up, I did read some place that mod-rewrite has to be enabled so that may be the problem waiting on a call back from host. Is there any way for me to check to see if mod-rewrite is enabled (kind of like a phpinfo() command or anything)?
__________________
Thanks
Jim M

"Lord, help me to become the person my dog thinks I am" - Dawn Ewing
"If you must know. Yes, I do enjoy running after the dog sled when I fall off" - Me

www.huskyzone.com -- Woodland Siberians
musher 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 07:39 PM.


Advertisement
Log in to turn off these ads.