Forum Moderators: phranque

Message Too Old, No Replies

My rewrite works correctly but my images are missing

         

MrSpeed

9:12 pm on Feb 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm doing a basic rewrite of
mydomain.com/category/subcategory
to
mydomain.com/products.php?parameter=$1/$2

RewriteEngine on
RewriteRule ([^/]*)/(.*) products.php?parameter=$1/$2 [L]

The rewrite works great but all my images do not display.

I tried a leading slash like "/images/logo.gif"

I have poured over a ton of posts here and I tried this solution
RewriteCond %{REQUEST_URI}!\.(exe¦css¦js¦jpe?g¦gif)$
(I changed the ¦ symbols)

Nothing seems to work.

yowza

9:28 pm on Feb 23, 2004 (gmt 0)

10+ Year Member



You might want to try using the absolute path for your images instead of the relative path.

http;//www.widgets.com/images/image.jpg

instead of

../image.jpg

MrSpeed

1:04 am on Feb 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I tried that and it will work as a backup plan.
I can also get everything to work if I place another directory in the url like mydomain.com/store/category/subcategory
and then
RewriteRule ^store/(.*)/(.*) products.php?parameter=$1/$2 [L]

I'm just baffled I can't it to work the way I want it to.

MrSpeed

1:41 am on Feb 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Here is the latest I tried. Still no luck
RewriteEngine on
RewriteCond %{REQUEST_URI}!^images [NC]
RewriteCond %{REQUEST_URI}!\.(jpe?g¦gif¦css¦js¦php) [NC]
RewriteRule ([^/]*)/(.*) products.php?parameter=$1/$2 [L]

jdMorgan

2:04 am on Feb 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Anchored patterns in RewriteCond will require a leading slash.

What directory is your mod_rewrite code in? And what directory are the images in?

Jim

MrSpeed

2:21 am on Feb 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



My mod_rewrite is at the root in .htaccess
My Images are off the root as well.

jdMorgan

3:33 am on Feb 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Strange, that should have mostly worked. You could try:

RewriteEngine on
RewriteCond %{REQUEST_URI} ![b]^/i[/b]mages [NC]
RewriteCond %{REQUEST_URI} !\.(jpe?g¦gif¦css¦js¦php[b])$[/b] [NC]
RewriteRule [b]^([/b][^/]*)/(.*) [b]/p[/b]roducts.php?parameter=$1/$2 [L]

If that does not work, you'll need to view your error log to figure out where it's going wrong.

Jim