Jump to content

rewrite help


acidglitter

Recommended Posts

i'm really new to this... in the .htaccess file of one of my sites i have..

 

RewriteEngine on
RewriteRule ^shop/([A-Za-z0-9]+)/ shop.php?c=$1

 

 

so when you go to mysite.com/shop/category/ it works fine. but the stylesheets are still in the mysite.com/css directory. what can i add so that all of my stylesheets/images/whatever will still show up right? i tried..

 

RewriteRule ^css/style\.css$ http://www.mysite.com/css/style.css

 

but it doesn't seem to be working at all. and it wouldn't help any of the images..

 

 

also, when you click a link it goes to mysite.com/shop/category/shop/category/page.html.... i know this could be fixed with html by putting <base href="mysite.com">, but isn't there a way to do this in the .htaccess file?

Link to comment
https://forums.phpfreaks.com/topic/118820-rewrite-help/
Share on other sites

  • 2 weeks later...

you could try:

 

RewriteCond %{HTTP_HOST} ^mysite.com [OR]

RewriteCond %{HTTP_HOST} ^www.*

RewriteCond %{REQUEST_URI} ^/shop/([A-Za-z0-9]+)/$

RewriteRule ^(.*)$   /site.php?c=%1 [L]

 

 

 

and ensure your hrefs always have the / at the beginning.

 

<link rel="stylesheet" type="text/css" href="/css/style.css" />

 

 

Link to comment
https://forums.phpfreaks.com/topic/118820-rewrite-help/#findComment-623366
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.