MDanz Posted August 1, 2011 Share Posted August 1, 2011 I've recently used mod_rewrite and changed my .htaccess allowing clean urls. Is there a tutorial that tells me how to use $_GET with a clean url? for instance how do i get the name with the clean url($_GET method)? messy url example.com/play.php?id=203&name=test clean url example.com/videos/play/203/test also when using forms is it as simple as changing <form action='submit.php' action='get'> to <form action='submit' action='get'> or do i have to do something else? Quote Link to comment https://forums.phpfreaks.com/topic/243461-clean-url-and-forms/ Share on other sites More sharing options...
the182guy Posted August 1, 2011 Share Posted August 1, 2011 Your clean URL should rewrite all the variables into the messy URL so you won't have to do anything with the $_GET. As for as the PHP script is concerened, it dosn't matter if it was a clean URL or messy. Forms are a different matter though, the action needs to be the working clean URL (not just 'submit'). If you're using GET forms then it will always look ugly. If you have several fields to submit try using POST where you can have a clean URL as the action, and all of the post data will be hidden from the URL. Depends what sort of data you're submitting in the form. Quote Link to comment https://forums.phpfreaks.com/topic/243461-clean-url-and-forms/#findComment-1250132 Share on other sites More sharing options...
MDanz Posted August 1, 2011 Author Share Posted August 1, 2011 Your clean URL should rewrite all the variables into the messy URL so you won't have to do anything with the $_GET. As for as the PHP script is concerened, it dosn't matter if it was a clean URL or messy. Forms are a different matter though, the action needs to be the working clean URL (not just 'submit'). If you're using GET forms then it will always look ugly. If you have several fields to submit try using POST where you can have a clean URL as the action, and all of the post data will be hidden from the URL. Depends what sort of data you're submitting in the form. Thanks for help. So your saying example.php?name=test and example/name/test.. if i use $_GET['name']; on the clean url it will be "test"?.. and i should change my GET forms to POST(hidden data), for the sake of clean urls? Quote Link to comment https://forums.phpfreaks.com/topic/243461-clean-url-and-forms/#findComment-1250137 Share on other sites More sharing options...
the182guy Posted August 1, 2011 Share Posted August 1, 2011 If you have your rewrite rules setup that way then yes. Have you got the rewrite rules in place? And yes, POST forms if you want SEO/clean URLs Quote Link to comment https://forums.phpfreaks.com/topic/243461-clean-url-and-forms/#findComment-1250171 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.