PlanetWebHost
01-13-2006, 02:12 PM
http://255.255.255.255/~user/dir => http://255.255.255.255/index.php?get=dir
Hello,
I use this mod_rewrite rule all the time and it works great...
RewriteRule ^([^.]+)$ index.php?get=$1
But now I'm in a situation where I need to get it working in conjunction with UserDir's, but I can't seem to get it working.
Apperantly I'm wrong, but I would think that RewriteRule ^/~user/([^.]+)$ index.php?get=$1 would be what I need, but that won't work for me.
Any help on getting this working is much appriceated.
liquid
01-13-2006, 03:49 PM
Im not sure if its possible to rewrite userdirs not sure though
ThatScriptGuy
01-13-2006, 04:41 PM
Agree with liquid here. I don't know that you can do that with user dirs. I tried doing a redirect with /webmail and cpanel ignored my .htaccess and went straight to the webmail interface.
Kevin
PlanetWebHost
01-13-2006, 04:50 PM
Ok thanks guys, I guess I'll try to get some more dedicated ips, or put them on subdomain or something.
Burhan
01-13-2006, 07:49 PM
There is an example similar to this at the URL Rewriting Guide (http://httpd.apache.org/docs/2.0/misc/rewriteguide.html).
Are your sure about your regular expression? Will it always be ~user?
PlanetWebHost
01-13-2006, 08:03 PM
There is an example similar to this at the URL Rewriting Guide (http://httpd.apache.org/docs/2.0/misc/rewriteguide.html).
Are your sure about your regular expression? Will it always be ~user?
No, I'm not sure about my regex
Yes, it will always be ~user, I'm trying to map the /dir to ?get=dir
Burhan
01-13-2006, 08:42 PM
Where are you placing this rule?
PlanetWebHost
01-13-2006, 08:50 PM
in my .htaccess file
This works great on regular domains, but is not working for me with a UserDir
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/images.*
RewriteRule ^([^.]+)$ index.php?get=$1
I just get 404 errors when I try to go to http://255.255.255.255/~user/dir
Burhan
01-13-2006, 10:20 PM
I don't know exactly what is the error, but I suspect that user directory browsing is enabled in Apache, which might be conflicting with your rule. Normally, with user directory enabled, domain.com/~login/ redirects to /home/login/public_html -- this is generally setup in httpd.conf
Your rule may not be overriding this default. If this is not a shared server, try and placing the rule directly in httpd.conf (or whatever is the default for your system), restart Apache, and try it again.