0

I have the following rewriting rules:

RewriteEngine On
RewriteBase /

RewriteCond %{THE_REQUEST} \s/+Category\.php\?Category=([^\s&]+) [NC]
RewriteRule ^ /C/%1? [R=301,L]

RewriteCond %{THE_REQUEST} \s/+product\.php\?id=([^\s&]+) [NC]
RewriteRule ^ %1? [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)?$ product.php?id=$1 [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^C/([^/]+)/?$ Category.php?Category=$1 [L,QSA]

the redirect work fine if you work from the home page, however when click trough to a product page on the /C/Category Name page it cannot find the product page. It is searching like so

http://localhost/C/product.php?id=302-Product-name

I presume that is because it thinks you are in a different folder. Not sure how to solve this.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Ria
  • 516
  • 6
  • 24

1 Answers1

1

I needed to add the <base href="/" /> so it will send all the links back to the root. Thanks so much again @anubhava from previous questions

Ria
  • 516
  • 6
  • 24
  • Yes that is helpful. You can accept your answer whenever SO lets you do that. – anubhava Mar 14 '14 at 18:01
  • @anubhava wondering if you can help me with another question, I know its has been a long time however you seem to have help somebody a while ago with a similar question. Here is the link : https://stackoverflow.com/questions/45988992/redirect-a-domain-from-https-to-http?noredirect=1#comment78938227_45988992 – Ria Aug 31 '17 at 20:45