homepage Welcome to WebmasterWorld Guest from 107.20.25.215
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
trouble with removing certain string in mod rewrite
rshandy




msg:4324776
 9:52 pm on Jun 10, 2011 (gmt 0)

Hi,

Been trying a multitude of rewrite and redirects i.e. Redirect permanent, RewriteRule and RewriteCond%{Query_String} nothing sees to work.

we have a site that used a ecommerce software called SoftCart which, when active always put /cgi-bin/SoftCart.exe/ in the url.

i.e. xyz.com/cgi-bin/SoftCart.exe/scstore/123.html

I want to redirect all old links that have "/cgi-bin/SoftCart.exe/scstore" in their url to just "/scstore"

For some reason the redirect commands don't like the "SoftCart.exe" nor the "cgi-bin" string. I've tried using the backslash as a delimiter for the '.' to no avail.

Any help would be greatly appreciated.

Thanks.

 

wilderness




msg:4324780
 10:07 pm on Jun 10, 2011 (gmt 0)

See this old thread [webmasterworld.com] and jdmorgan's explanation

rshandy




msg:4325507
 3:33 pm on Jun 13, 2011 (gmt 0)

Thanks, but after reviewing that thread it doesn't seem to have a correlation to what I'm trying to do.

I'm using an a .htaccess file to perform permanent redirect either by using the RewriteCond, RewriteRule or Redirect permanent commands.

I just can't seem to get anything to redirect that has a dash or a dot in the path.

For example, using the Redirect permanent command I can do this:

Redirect permanent /cgibin/SoftCartexe/scstore [123safe.com...]

but it won't do this:

Redirect permanent /cgi-bin/SoftCart.exe/scstore [123safe.com...]

I also tried this:

Redirect permanent /cgi-bin/SoftCart\.exe/scstore [123safe.com...]

Apache must have some safeguard for cgi-bin and dots within a url string. I can using other hyphenated terms in the url string:

Redirect permanent /try-this/scstore [123safe.com...]

But not that has a "." in it or "cgi-bin"

Any ideas?

Thanks

wilderness




msg:4325520
 4:01 pm on Jun 13, 2011 (gmt 0)

The correlation is that your script is overriding/interfering with the htaccess, as jdmorgan explained.

Either correct of disable your script entirely.

Please refer to forum charter and use of example.com for domain names, otherwise the assistance your asking for us unable to read your syntax.

rshandy




msg:4325621
 7:34 pm on Jun 13, 2011 (gmt 0)

oops sorry, my bad. I was cutting and pasting from my .htaccess file.

I re-read the thread and I'm hoping my situation is not that complicated. I just want to grab old links that were pointing to product pages that contain the string "cgi-bin/SoftCart.exe/scstore to /scstore.

I'm NOT writing a script, I'm just putting the redirect in the root .htacces file.

Isn't there a way for the .htaccess file recognize any given string within the url and strip it out?

to reiterate what I want to do using the example.com protocol:

For example, using the Redirect permanent command I can do this:

Redirect permanent /cgibin/SoftCartexe/scstore http://www.example.com/scstore

but it won't do this:

Redirect permanent /cgi-bin/SoftCart.exe/scstore http://www.example.com/scstore

I also tried this:

Redirect permanent /cgi-bin/SoftCart\.exe/scstore http://www.example.com/scstore

Apache must have some safeguard for cgi-bin and dots within a url string. I can using other hyphenated terms in the url string:

Redirect permanent /try-this/scstore example.com/scstore

But none that has a "." in it or "cgi-bin"

Any ideas?

Thanks

g1smd




msg:4325622
 7:38 pm on Jun 13, 2011 (gmt 0)

As far as I know, CGI requests are "grabbed" by the respective handler before mod_rewrite has a chance to get to them.

rshandy




msg:4325653
 8:50 pm on Jun 13, 2011 (gmt 0)

oh, that makes sense. Any easy was to rectify this? Now, its back to something the JD was referring in an old post. Can a simple script be made and called SoftCart.exe to redirect to the new url string?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved