Forum Moderators: phranque

Message Too Old, No Replies

Small problem rewriting domain names

         

Donboy

6:18 pm on Mar 25, 2004 (gmt 0)

10+ Year Member



I'm using a rewrite rule that I found on this site, and it seems to be working well, but I keep getting a trailing slash. Here's the rule...

RewriteEngine on
RewriteCond %{HTTP_HOST}!^secure.mydomain.com
rewriterule ^(.*)$ [secure.mydomain.com...] [R=301,L]

When I enter www.mydomain.com in the browser, I get the following after the rewrite...

[secure.mydomain.com...]

Notice the ugly trailing slash? Any way I can use a different rule that will eliminate that?

jdMorgan

2:47 am on Mar 26, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Donboy,

If your code is installed in httpd.conf then this will happen because the code was intended for use in .htaccess.

For use in httpd.conf, use either:


RewriteRule ^(.*)$ https://secure.mydomain.co[b]m$1[/b] [R=301,L]

-or-

RewriteRule [b]^/([/b].*)$ https://secure.mydomain.com/$1 [R=301,L]

Subtle, but it matters.

Jim

Donboy

4:44 am on Mar 26, 2004 (gmt 0)

10+ Year Member



Heh! That worked! Man, what a small difference. Thanks JD. You're the man!