Mod rewrite question

Hi guys!

I have mod_rewrite rules setup, which redirect users from:
http://www.mydomain.com/domains/xyz.com

TO:

http://www.mydomain.com/details.php?domain=xyz.com

However, I want to modify it so that I can redirect users from:
http://www.mydomain.com/xyz.com

TO:

http://www.mydomain.com/details.php?domain=xyz.com

How can I modify my .htaccess file so that this is possible?

.htaccess file…


Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteRule ^domains/(.*)/? /details.php?domain=$1 [NC,L]

Thanks.

Well, i’m not a mod_rewrite guru, but my response would be that you want your rule to read as
“Anything that doesnt start with details.php should be rewritten as details.php?domain=$1”

Don’t you mean redirect [noparse]http://www.mydomain.com/xyz.com[/noparse] to [noparse]http://www.mydomain.com/domains/xyz.com[/noparse], since that’s the current URL that also redirects to the PHP or do you really want to redirect it to the PHP itself ?

No…my links will point to http://www.mydomain.com/xyz.com and I want it to load http://www.mydomain.com/details.php?domain=xyz.com

Do you see?

So [noparse]http://www.mydomain.com/domains/xyz.com[/noparse] and [noparse]http://www.mydomain.com/xyz.com[/noparse] should show the same page? Why? That’s duplicate content

Ahh sorry, I probably didn’t explain myself. I won’t be using [noparse]http://www.mydomain.com/domains/xyz.com[/noparse] anymore. So I will just be using [noparse]http://www.mydomain.com/xyz.com[/noparse] instead.

Ah, now it makes sense! :slight_smile:


Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)/? /details.php?domain=$1 [NC,L]

:slight_smile: