Hi all! I have dug through the heaping amounts of mod_rewrite threads here and elsewhere and have come to no end!

I am wondering if this is not working because:
A) 1&1 Hosting is garbage.
B) Its on a subdomain.

Here is my code.

RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)$ profile.php?username=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ profile.php?username=$1

Essentially I want it to work like this
http://wishlist.mellowmedia.ca/Dave points to http://wishlist.mellowmedia.ca/profile.php?username=Dave

Any ideas?

Recommended Answers

All 3 Replies

Hey.

I don't see a problem in the rules. Even tried it and it worked fine on my test server.

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^([a-zA-Z0-9_-]+)/?$ profile.php?username=$1
</IfModule>

Note that I combined the two rules into a single rule. The /? at the end there means: 0 or 1 forward-slash. Doesn't really change anything tho, except saves you the extra line.

The sub-domain thing shouldn't have any effect on this. Maybe it is a problem with your host?

1AND1.. what a bad webhost.

Member Avatar for diafol

Re hosts:

If you've got a budget package, very often you don't get the full control. For htaccess, you may need to upgrade. Some hosts request that you send them the htaccess file and they will put it up for you.

HOWEVER.

It could be that you uploaded the .htaccess file with that filename. This can often mess up the file. Try uploading again as htaccess.txt (via FTP) and then renaming it .htaccess.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.