Forum Moderators: phranque

Message Too Old, No Replies

.htaccess - Bypass processing query-string and read the eqv. filename

htaccess query-string bypass filename

         

harababura

5:12 pm on May 8, 2008 (gmt 0)

10+ Year Member



Hi!

1. I mirrored a web page on my computer and I am trying to fix things in order to access the local copy.

2. To copied the page using "wget" which downloaded about 12.000 files named: "content.aspx?item=&lang=yyyy". These are the real filenames on disk (including the "?" and "&" characters). One web page refers another with such URLs. All of them were rewritten by wget in order to be relative, not absolute so it should work locally (on the downloaded mirror)

3. I did some adjustment with ".htaccess" but my main problem is I can not "persuade" Apache that:

www.mydomain.com/content.aspx?item=&lang=yyyy

should go and read the file:

/var/www/content.aspx?item=&lang=yyyy

instead of reading "content.aspx" and passing it the query-string "item=&lang=yyyy".

Is there a way to solve this problem?

Thank you!

TheMadScientist

5:31 pm on May 8, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Am I correct in understanding you are attempting to put a mirror of your competitor's website online?

harababura

5:48 pm on May 8, 2008 (gmt 0)

10+ Year Member



You are joking, is that right? :) No, it has nothing to do with this site...

TheMadScientist

5:55 pm on May 8, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



No, I was actually serious.

If you are attempting to put a duplicate of a competitors site online I feel rather disinclined to tell you how to get Apache to recognize the URLs. (I also sincerely hope other feel the same as I do.)

harababura

5:56 pm on May 8, 2008 (gmt 0)

10+ Year Member



LE: Sorry, I saw: "of our competitor's website online" instead of "your competitor's website online"! :)

No. I have a backup of a Windows machine which is down for a while because of hardware fault and I just want to rise the page up asap (on a Linux machine available).

jdMorgan

6:12 pm on May 8, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You have copied a dynamic site, and are trying to access it as if it were static. The problem is that "content.aspx" is a script, and the query strings are used to tell it how to retrieve content from a database in order to "build" each page on-the-fly.

Instead of using WGET to download the HTML pages which are created by content.aspx, you need to use SFTP or FTP to download the site's files, so that all scripts and databases are downloaded in their original form.

If the server was Windows-based, then you'll need to run your local copy of the site on a Windows server (IIS) as well, unless you have a lot of free time to adapt things...

Jim

harababura

6:22 pm on May 8, 2008 (gmt 0)

10+ Year Member



Thank you, Jim!

P.S. I just renamed the files (replaced ? and & and made the correct "rewrites") to get rid of some pressure from customers (95% of the functionality is ok) until the Windows machine will be up again.

TheMadScientist

6:46 pm on May 8, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I mis-read.
I got competitors website out of the deal somewhere...
That's twice today.

g1smd

6:49 pm on May 8, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hmm. I always redirect requests for filename.html&query=value over to filename.html?query=value (301 redirect).

I have a habit of typing domain.com/filename.html&query=value when testing a site, and that usually returns a 404 error.

The redirect allows me to test the site, without ever getting the error message appear.