Welcome to WebmasterWorld Guest from 54.167.29.212

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Passing along variables during a htaccess 301 redirect

Do I have other options besides keeping it in the page address?

     

otem

5:46 am on May 22, 2007 (gmt 0)

5+ Year Member



I have a form people fill out on my website, and on submit they are then sent to an appropriate document depending on their input.

Some people link directly to those documents instead of to my form page which the preferred method. Therefore I added to my .htacess a 301 redirect to the form page for visitors requesting documents with a referer other than blank or from my domain.

The 301 redirect is important to me so people's address bars change to the matching page, and for search engines to accredit the form page for the incoming links.

My only concern is, once there, the visitor will see an empty form. For usability, I would strongly like to send which document the user requested to the form page, so once loaded, the form will be pre filled out for their appropriate document.

I would know how to do this using my .htaccess page if I wanted to have that document name in the address bar, but I would strongly like to have the address bar be the normal form page address.

Is it possible that in the redirect I can send that variable in a POST type method, where the information is not visible in the address bar?

I guess if I can't do the first I could redirect the visitor to an intermediary page that just reads the variable in the link and stores that value in a cookie before sending the visitor off the the form page.

Is there a perfered and elegant method? Do I have other options?

I would greatly appreciate your feedback.

phparion

8:52 am on May 22, 2007 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



I guess the best and easy method will be to use cookies or sessions to carry different variables to different pages.

otem

11:46 pm on May 23, 2007 (gmt 0)

5+ Year Member



Thank you for your help.

I setup my site now to have the redirect write a session cookie, and for the main page to be aware of the cookie, and to customize the page based on it's presences.

Works great, thanks!

This however opens up two questions.

I know people look at cookies with disdain, with some people not accepting cookies, or not able to accept cookies (not to mention the people who delete them). Are session cookies looked at the same way as regular cookies? Should I expect more people being able to receive them?

Also, I setup my .htaccess to look out for document requests from domains other than my own or blank, and to send them to this redirection page, since I don't want people to access the documents directly.

I currently have all my documents in a folder that's been disallowed in my robots.txt file. I was thinking, the 301 redirect won't give any "link love" to my main page because the search engines won't look at the files to begin with, and also because they use a blank referral when accessing the pages. Any ways around this?

Thanks

 

Featured Threads

Hot Threads This Week

Hot Threads This Month