1001 Postcards Love Love Love Meep Meep ZenZodiac DailyQuotation

Using mod_rewrite with cpshop





EMAIL MARTY message board
  « Using mod_rewrite with cpshop »
Welcome, Guest. Please Login or Register.
02/21/18 at 17:09:35
Home Help Search Login Register message board
   About cpshop
   Customization Help
   Using mod_rewrite with cpshop
(Moderator: Marty)
Pages: 1 Reply Notify of replies Send the topic Print 
   Author  Topic: Using mod_rewrite with cpshop  (Read 1112 times)
Gold Dragon

Posts: 171

Go Scots!

Using mod_rewrite with cpshop
« on: 10/04/07 at 14:03:57 »
Reply with quote Modify message

Ok.. I'm pulling my hair out on this one.  I cannot get this to work for the life of me.  I really don't know what I'm doing with mod_rewrite other than trying to piece together bits from googling.  

I have a physical /shop directory and placed this .htaccess in that folder and everything works.  

RewriteEngine on
RewriteRule ^([^*]+)/?$ /cgi-bin/shop/shop.cgi/$1 [L]

Problem is that I want it done the proper way so that a 301 can be used and at least tell search engines not to use the old urls.  

I've tried creating and using this at the base directory in the .htaccess and have had no luck.

Options +Indexes
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteRule ^shop/(.*)$ cgi-bin/shop/shop.cgi/(.*) [L]

I've also tried this which works...

RewriteEngine on
RewriteRule ^shop/([^*]+)/?$ /cgi-bin/shop/shop.cgi/$1 [L]

..but if I add the 301 on it it screws it up and seems to do the reverse and if you point to are url like it will redirect to the full cgi-bin/shop/shop.cgi
That is where I'm lost!  Ugh.

RewriteEngine on
RewriteRule ^shop/([^*]+)/?$ /cgi-bin/shop/shop.cgi/$1 [R=301, L]

Any ideas?  Any help would be greatly appreciated.  TIA!
« Last Edit: 10/04/07 at 14:16:13 by flippinsweetgear » Logged

Flippin Sweet Gear | Kids T-shirts | Big Lebowski Shirts
Gold Dragon

Posts: 439


Re: Using mod_rewrite with cpshop
« Reply #1 on: 10/07/07 at 07:54:45 »
Reply with quote Modify message

It's not real clear what you want to redirect to from where, but if you have a Shop folder in your cgi-bin say, and you have a shop.cgi in the shop folder, you would use

RewriteRule ^shop\.cgi(.*)$ /cgi-bin/shop/shop.cgi$1 [R=301,L]

in the htaccess file in you shop folder.
You don't want the trailing slash / after .cgi in either place. It will screw you up on parts of it, and will seem to work fine on others.
You also usually want to include the full URL in the redirect, not a relative URL.

But, that all said, the above redirect will redirect to what is already /shop/shop.cgi to /shop/shop.cgi. Why do you want to do that?
Pages: 1 Reply Notify of replies Send the topic Print 
Jump to: message board (

Powered by YaBB 1 Gold - Release (Yet Another Bulletin Board)
Copyright 2000-2001, X-Null. All Rights Reserved.