View Full Version : .htaccess question

10-01-2007, 06:56 AM
I have (or rather had) a site where someone would enter www.mysite.com/something. The 'something' did not exist, but using .htaccess I sent it to a page called www.mysite/com/lookup.html where a bit of javascript would parse that piece off the URL and use it as data. I looked 'something' up in a database using php, and if it found it, I sent it to a page that would display some stuff from the database.
I say 'had' instead of 'have', because the site is now on a different (though still apache) host, and the .htaccess is working differently. Now when I look at the URL in lookup.html, instead of finding the original www.mysite.com/something, I am finding www.mysite.com/lookup.html. Any idea what I could have done wrong? On the old site, I had coded the .htaccess from scratch. On the new site, the host had generated a bunch of additional lines. I can attach the old and new version if that will help at all.

10-01-2007, 10:20 PM
I can attach the old and new version if that will help at all.
Yes please do.

10-02-2007, 03:09 AM
you may not have done anything wrong. The htaccess file functionality/defaults can be controlled by what is in the apache conf file so your apache servers very likely are configured differently:

so to redirect any specific file this should work but only if you have the authority as granted in apache conf file to do it.

Redirect permanent /something.htm http://www.mydomain.com/anydirectory/anyfilename.htm

easiest if you give the actually file names and locations and then I can be certain of getting it right.

10-02-2007, 04:23 AM
The thing is, it does redirect. My problem is getting to the value of the original URL.

10-03-2007, 04:09 AM
Thanks for the reply. The problem turned out to be...programmer headspace. In the environment that worked, I had coded the error 404 page as a file path off of the document home. In the one that wasn't working, I had enteted it as a URL. As soon as I changed it to a file path, it worked as I wanted it to.