Jump to content


mod_rewrite


6 replies to this topic

#1 Stu

    Retired P2L Staff

  • Publishing Betazoids
  • PipPipPipPip
  • 1,761 posts
  • Gender:Male

Posted 10 October 2005 - 06:35 AM

is anyone in the know about mod_rewrite? ive got it working, its redirecting my urls to how i want them, but its not using my style sheet?

strangely enough also when i put my style sheet in anywhere but the root then it will not work properly, the layout and positioning is ok but some of the images dont show up and its just a general mess

ie. if i put it in a folder called style and change the link to style/style.css

you can view the site here and the css here

the code i have in my htaccess for mod rewrite is:

Quote

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^home/$ index.php?id=home
RewriteRule ^portfolio/$ index.php?id=portfolio

note: yes ive only done two cus i couldnt be bothered doing them all im just testing.

#2 Jamie Huskisson

    Retired P2L Staff

  • Members
  • PipPipPipPip
  • 3,648 posts
  • Gender:Male
  • Location:Nottingham, UK

Posted 10 October 2005 - 06:53 AM

add:
<base href="http://www.stu3d.com/home/" />

in your header tags..

#3 Stu

    Retired P2L Staff

  • Publishing Betazoids
  • PipPipPipPip
  • 1,761 posts
  • Gender:Male

Posted 10 October 2005 - 07:06 AM

problem solved.

needed to add FULL links to everything whilst using mod rewrite

ie instead of style.css or images/image.gif it needs to be http://domain.com/style.css or http://domain.com/images/image.gif

thanks jay :)

#4 Jaymz

    Retired P2L Staff

  • Members
  • PipPipPipPip
  • 4,104 posts

Posted 10 October 2005 - 09:34 AM

I use /images/image.gif with mine :) Works like a charm.

#5 Stu

    Retired P2L Staff

  • Publishing Betazoids
  • PipPipPipPip
  • 1,761 posts
  • Gender:Male

Posted 10 October 2005 - 01:03 PM

Jaymz, on Oct 10 2005, 02:34 PM, said:

I use /images/image.gif with mine :P Works like a charm.
just curious james, can we see a bit of your .htaccess?

#6 Jaymz

    Retired P2L Staff

  • Members
  • PipPipPipPip
  • 4,104 posts

Posted 10 October 2005 - 01:24 PM

Basic:
#DIRECTORIES WITH TRIALING /
	RewriteRule ^portfolio/$ /categories.php 
	RewriteRule ^about_us/$ /about.php 
	RewriteRule ^top5/$ /top5.php
	RewriteRule ^affiliates/$ /affiliate.php  
	RewriteRule ^contact_us/$ /contact.php

Confusing as hell at times:
# CATEGORIES
	RewriteRule ^view/([A-Za-z0-9-]+)/?$ viewinfo.php?id=$1
	RewriteRule ^detail/([A-Za-z0-9-]+)/?$ viewbig.php?id=$1


#7 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 10 October 2005 - 04:15 PM

also note, my site uses .htaccess, and i dont' have a single full path to anything.
I just did what Jay said, and added the <base> tag. So if you want to save some bandwidth, you can do that and avoid have all your links look like <a href="http://domain.com/blah.php">





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users