Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.