Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jan 2006
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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!

  • #2
    Regular Coder
    Join Date
    Jan 2006
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #3
    Regular Coder musher's Avatar
    Join Date
    Jan 2005
    Location
    Minnesota
    Posts
    203
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •