[HELP] Make user profiles .htaccess?
Hi, I want to be able to make user profiles like this:
Code:
www.site.com/username
Instead of things like:
Code:
www.site.com/profile/username
So, in my .htaccess file I have:
Code:
RewriteEngine On
RewriteRule ^/(.*)$ profile.php?user=$1 [L]
But then, that means if I go to a link like
Code:
www.site.com/contact/
In .htaccess it will process:
Code:
www.site.com/profile.php?user=contact
Any ideas on how to do it? I've seen it on other sites and it works fine for them.
Any usefull help will be fully appreciated and 'thanked'.
Thanks,
- m0nsta.
Re: [HELP] Make user profiles .htaccess?
Put a .htaccess in a folder, make a .htusers for that specific folder. Done.
.htaccess Tutorial - Part 1
Edit: Ehh NVM looks like your trying to do something a little different, above link might help you anyways
Re: [HELP] Make user profiles .htaccess?
Quote:
Originally Posted by
billybombill
Put a .htaccess in a folder, make a .htusers for that specific folder. Done.
.htaccess Tutorial - Part 1
Edit: Ehh NVM looks like your trying to do something a little different, above link might help you anyways
Thanks for your help, but my PC has a virus and I can't view certain sites, but I'm buying a new harddrive next week so that should fix the problem, so when I get it I'll check that link out.
I thanked you.
Re: [HELP] Make user profiles .htaccess?
Quote:
Originally Posted by
m0nsta.
Hi, I want to be able to make user profiles like this:
Code:
www.site.com/username
Instead of things like:
Code:
www.site.com/profile/username
So, in my .htaccess file I have:
Code:
RewriteEngine On
RewriteRule ^/(.*)$ profile.php?user=$1 [L]
But then, that means if I go to a link like
Code:
www.site.com/contact/
In .htaccess it will process:
Code:
www.site.com/profile.php?user=contact
Any ideas on how to do it? I've seen it on other sites and it works fine for them.
Any usefull help will be fully appreciated and 'thanked'.
Thanks,
- m0nsta.
Add a rewrite rule for your matching pages (e.g. aboutus, contact, home), then below that, keep the user profile rules.
For example:
Code:
RewriteRule ^(aboutus|contact|home)$ page.php?p=$1 [L]
RewriteRule ^(.*)$ profile.php?user=$1 [L]
Good luck.
Re: [HELP] Make user profiles .htaccess?
@Ian: i didnt think about that :O
@m0nsta: you could use Malwarebytes if it lets you, ive used it for a few years ad works good (doesn't replace ant virus software but it scans well)
Re: [HELP] Make user profiles .htaccess?
Thanks to you both :)
I'll try your method out now Ian