Re: URL's and htaccess maybe
The standard way of doing something like that is using mod_rewrite http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html
Re: URL's and htaccess maybe
ok thanks, now i need help with mod_rewrite :P. i suck at regular expressions...
Re: URL's and htaccess maybe
I have never used it myself, but there are lots of guides/tutorials on how to use it...
Re: URL's and htaccess maybe
Hm... this is an interesting topic, anyone else provides a "help?"
Re: URL's and htaccess maybe
To redirect by user IDs or name differently, you need two rules:
Code:
RewriteEngine On
RewriteRule ^([0-9]+)$ files/view_profile.php?id=$1 [L]
RewriteRule ^([0-9A-Za-z_]+)$ files/view_profile.php?name=$1
Note that the second of those will only allow user names containing characters that are alphanumeric or underscores. You may want to add additional characters. However, don't add a dot (\.) as that will cause rewriting to take place on URIs for things like images and CSS/script files.
Re: URL's and htaccess maybe
well i think i will have it so the var id will be for both name and id number, then i will do the checking in php,
what do i need to change in your code?
Re: URL's and htaccess maybe
this .htaccess file was used for the other script i used to use, can some one translate it for me :P
Code:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ view_profile.php?member_id=$1
Re: URL's and htaccess maybe
In this line: RewriteRule ^(.*)$ view_profile.php?member_id=$1
^ matches the start of the string. $ matches the end of the string and (.*) matches and captures anything in between. The $1 at the end of the string gets replaced with whatever (.*) captured