homepage Welcome to WebmasterWorld Guest from 174.129.103.100
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 / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Passing along variables during a htaccess 301 redirect
Do I have other options besides keeping it in the page address?
otem




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

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




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

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

otem




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

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
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