twitter link url for user page |
[eluser]GregSmith104[/eluser]
How would I go about handling http://mysite.com/<username> so that it calls a "user" controller, but hides the "user" controller in the url? I don't want something like this http://mysite.com/user/<username> Would this be best achieved using URL ReWriting in the .htaccess file or is there some way through the Codeigniter URI classes that I can lookup the <username> and if it's valid route to the "user" controller passing the <username>. Thanks Greg
[eluser]GregSmith104[/eluser]
Got it I used the route.php config file and added the following: Code: $route['auth(.+)*'] = "auth$1"; This is a little dirty in that I'd have to add a line for every controller other than the "user" controller, but it does work. Greg
[eluser]GregSmith104[/eluser]
Ok, So my solution kind of works... http://example.com/username works fine, but http://www.example.com/username doesn't the Apache logs are showing: File does not exist: /var/www/html/mysite/username Is this a problem with the .htaccess file, routes, or Apache? Thanks in advance! Greg
[eluser]GregSmith104[/eluser]
Most of this is code I got from around the net...not 100% what all of this is doing... Code: RewriteEngine On
[eluser]Ben Edmunds[/eluser]
I'm not sure whats up with the issue with the www... Maybe someone else can help? in the mean time you could just rewrite it with something like this: Code: #RewriteCond %{HTTP_HOST} !^www\.example\.com$ |
Welcome Guest, Not a member yet? Register Sign In |