The simplest and easiet answer is to switch the form from method=get to method=post and not worry about .htaccess to 'rewritre' the urls to try and hide data.
I can understand that you'd want to have nice and tidy URLs, but the GET request can actually be a very good thing to keep. It lets people bookmark that particular set of data and makes it available via its URL. If you got rid of it then Google might find the page in question, record the content, and then offer it as a result to someone trying to search for information on that page. If you have lots of different sets of data (in this instance I guessing it's different classes) and they all share the same URL, then Google is likely to offer the page as a potential search match and even show some of the desired content in the little snippets it displays under each link. However because the same URL is used for many sets of data, it's very unlikely that the link will point to your content that Google says is a good match. When the searcher clicks the link they're likely to get completely different content from that indicated in the snippets in Googles listing.
Last edited by Stephen Philbin; 08-09-2009 at 06:43 PM.
I can understand that you'd want to have nice and tidy URLs, but the GET request can actually be a very good thing to keep. It lets people bookmark that particular set of data and makes it available via its URL. If you got rid of it then Google might find the page in question, record the content, and then offer it as a result to someone trying to search for information on that page. If you have lots of different sets of data (in this instance I guessing it's different classes) and they all share the same URL, then Google is likely to offer the page as a potential search match and even show some of the desired content in the little snippets it displays under each link. However because the same URL is used for many sets of data, it's very unlikely that the link will point to your content that Google says is a good match. When the searcher clicks the link they're likely to get completely different content from that indicated in the snippets in Googles listing.
I think stupid etc is not right if some one has a question and did knot know about any thing then he ask over here
so we should reply him in better way.
I think URL rewrite helps to solve your problem.
but How if your query sting has space then the how the URL will look like.
It just looked to me like you were trying to have the same nice, simple, tidy URL cover all values. I have a similair tidy URL thing set up on my site. As far as I can tell, the method I use is unusual. I think most articles I've seen on the subject tend to go for using some form of URL translation; taking parts of a URL and translating it into a GET request (or vice-versa?), but I find my approach much simpler. I just redirect all calls to any file or folder inside directory A back to directory A and then just stick a PHP script in that directory that breaks up the URL into smaller sections and uses those sections for stuff like database queries etc. The end result (how the URLs look to the user) is the same, but the implementation is slightly different.
Of course. Here's the Apache directive I use to send all apparently valid addresses back up the directory structure to the PHP file that actually figures out what should be sent to the user based on the URL requested.
Code:
##### ALIASING FOR BLOG ENTRY READING ##########################################
AliasMatch ^/blog/\d{4}-\d\d-\d\d/[^/]+/?$ "/usr/local/apache2/htdocs/blog/index.php"
##### END ALIASING FOR BLOG ENTRY READING ######################################
The actual PHP file lives at /blog/index.php on my server. The Apache directive instructs Apache to take any URL that starts /blog/ and then has a DD-MM-YYYY-format date and then a / with pretty-much anything after that and redirect it back to /blog/index.php. Any request for a URL that doesn't match this scheme and does not exist will (rightly) cause Apache to just return a 404.
So once a URL that initially appears to be valid has been redirected to /blog/index.php the PHP script then breaks the URL up into smaller chunks, validates them and then uses them in an SQL query to retrieve the content. For example my scheme checks to see if the date portion is a valid date and then queries the database for content with a matching date of creation and a title that matches the rest of the URL.
You'll need to decide how to handle special characters (such as spaces and question-marks) in your URL's title section to avoid unexpected errors, but that's petty much all there is to it.
And expect a script to know it needs to use id 15 or id 2000. How can it possibly know that. The only solution you could use that might come close is similar to suggested already and add the id into the url eg
Bookmarks