emehrkay Posted April 29, 2007 Share Posted April 29, 2007 I've done some looking around and I dont know if what I am looking for has been talked about. I have apache running, but it is a shared server (for now) so I figured htaccess would be my only weapon in this matter. What I want to do is use an MVC-like approach but have more than just the index page. So I want the urls to read like site.com/users/emehrkay/bio and before i would impliment the clean url scheme, it would read site.com/users.php?user=emehrkay§ion=bio so just like in the first example, you can do site.com/page/var/var with page and var all being variable is that possible? users.php isnt the only page that there will be. Does that make sense? Ill do some more reading on the subject and see if I can find anything. Thanks Quote Link to comment Share on other sites More sharing options...
heckenschutze Posted April 29, 2007 Share Posted April 29, 2007 Yes, if your server has mod_rewrite installed then you can do it via .htaccess, its a complex rule but it can be done so /page is a page... Which I don't know how to do. Otherwise, you can read $_SERVER["QUERY_STRING"] or something and parse it yourself... Quote Link to comment Share on other sites More sharing options...
cwncool Posted April 29, 2007 Share Posted April 29, 2007 If I am understanding your question correctly, couldn't you do that with something like this in an .htaccess file in the directory your site is at: Options +FollowSymlinks RewriteEngine On RewriteRule ^users/(.*)/(.*)/?$ /users.php?user=$1§ion=$2 ...and just repeat rewrite rules like for each different thing you want to do? Quote Link to comment Share on other sites More sharing options...
emehrkay Posted April 29, 2007 Author Share Posted April 29, 2007 If I am understanding your question correctly, couldn't you do that with something like this in an .htaccess file in the directory your site is at: Options +FollowSymlinks RewriteEngine On RewriteRule ^users/(.*)/(.*)/?$ /users.php?user=$1§ion=$2 ...and just repeat rewrite rules like for each different thing you want to do? ahh very simple, thank you. now i just need to get my htaccess file working locally so i can test it Quote Link to comment Share on other sites More sharing options...
emehrkay Posted May 13, 2007 Author Share Posted May 13, 2007 is there a way for me to exclude a section of code if it is running on localhost? Quote Link to comment Share on other sites More sharing options...
emehrkay Posted May 13, 2007 Author Share Posted May 13, 2007 If I am understanding your question correctly, couldn't you do that with something like this in an .htaccess file in the directory your site is at: Options +FollowSymlinks RewriteEngine On RewriteRule ^users/(.*)/(.*)/?$ /users.php?user=$1§ion=$2 ...and just repeat rewrite rules like for each different thing you want to do? ok i used this to replace my query strings, just like you wrote it print_r*$_GET) works fine, the variables are shown. but the page doesnt work anymore. I dont know what the problem is, it seems like it works as it should but without the css. I look at the css editor in the webdeveloper toolbar and it is filled with the page's html. am i doing something wrong? Quote Link to comment 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.