users on my server can goto mywebaddress.com/~username
How can i add something to my root directory, so that when they type in mywebaddress.com/username, it goes to mywebaddress.com/username
Thanks.
| SitePoint Sponsor |



users on my server can goto mywebaddress.com/~username
How can i add something to my root directory, so that when they type in mywebaddress.com/username, it goes to mywebaddress.com/username
Thanks.





wouldn't a simple redirect do the trick?
.htaccess
Code:Redirect /~username http://www.mywebaddress.com/username

Scheiss,
duuudie's got it right! mod_alias is more appropriate than mod_rewrite (even though less flexible) but this one's simple.
Thanks, duuudie, for the prod to go find out about that (mod_alias) Redirect!Originally Posted by apache.org/docs/mod/mod_alias.html
Regards,
DK
David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
Client and (unpaid) WHB Ambassador
Updated mod_rewrite Tutorial Article (setup, config, test & write
mod_rewrite regex w/sample code) and Code Generator



Thanks. So how could i redirect an image if an image is not found on my page? I have this but it isn't working:
Thankyou.Code:ErrorDocument 404 /shop/img/usr/

Scheisskopf,
To give you a good (correct) answer would require that we know both the link in the page that can't find the image AND the actual location of that image.Originally Posted by Scheisskopf
The article at datakoncepts.com/seo provides a warning about mod_rewrite's effect on relative links. The use of the HTML BASE tag (giving the actual web location of the page) would resolve the problems generated for relative links.
Regards,
DK
David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
Client and (unpaid) WHB Ambassador
Updated mod_rewrite Tutorial Article (setup, config, test & write
mod_rewrite regex w/sample code) and Code Generator



No because it doesn't actually exist as a folderwouldn't a simple redirect do the trick?
basically /~username shows a users web page on cpanel
i would like their webpage to show at /username, even though that folder doesn't exist
is this a mod rewrite problem?
Either that or add the username so it becomes a sumdomain:
i.e. from www.site.com/~username to username.site.com
Thankyou.

Scheisskopf,
No, it's not a problem!Originally Posted by Scheisskopf
That should do the trick (**IF** your usernames are lowercase) and keep the scriptname, too!Code:RewriteEngine On RewriteRule ^([a-z]+)(/.*)?$ path-to-$1/$2 [L]
Regards,
DK
David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
Client and (unpaid) WHB Ambassador
Updated mod_rewrite Tutorial Article (setup, config, test & write
mod_rewrite regex w/sample code) and Code Generator

Scheisskopf,
pippo's given a link which led me to the Dynamically configured mass virtual hosting documentation where DYNAMIC virtual hosts can be created. You may want to take a look at that.
Regards,
DK
David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
Client and (unpaid) WHB Ambassador
Updated mod_rewrite Tutorial Article (setup, config, test & write
mod_rewrite regex w/sample code) and Code Generator
Bookmarks