问题
I have made most my site SE friendly, but one part of my site bugs me...
I have a HUGE form in one of the pages, and when submitting the form (action=php_page) URL is so long it covers half a word document in one line with all the passing variables...
This is very ugly...
Is there any way to make this long URL appear short?
Or some other solution you know of?
Let me know if you need more input...
Thanks
回答1:
How about using POST instead of GET?
<form action="action.php" method="post">
In action.php
you would have to use $_POST
instead of $_GET
.
Remember that you should always redirect to a page that shows that the action is successful after processing a form (in this case in action.php
) using header('success.php');
. If the user were to refresh the page, the action won't happen twice (which would be unfortunate if you were to write something to a database or something similar).
回答2:
You can use POST instead of a GET, although it wouldn't be bookmarkable, not very SEO friendy, less friendly then a long URL even. If people should be able to bookmark it/ treat it as a link, you have about 4 options:
- Shorter the form considerably.
- If selects & checkboxes, seriously shorten their names and actual values sent (again,not very SEO friendly: Google et al. like their keywords in the URL).
- Think of a lot of shorter descriptions for the possibilities posted, and redirect those combo's to a shorter URL (if it's even possible to capture those combinations).
- Forget about the form URL: it's there, people will use it. Do however disclose your content for crawl in a manner a bot can follow: maybe typicial searches become tagcloads, selectboxes can become crawlable hierarchical structures etc. It's about getting people to content they sort of like to your domain, and then offer them a form as service to get to the great content.
来源:https://stackoverflow.com/questions/3000524/how-to-make-this-very-long-url-appear-short