Reputation:
I'm trying to redirect my IP address and my Dynu domain to my actual domain.
This currently works:
# Rewrite Rules
RewriteEngine On
RewriteCond %{HTTP_HOST} !^muffy.northernia.com$
RewriteRule ^(.*)$ http://muffy.northernia.com/$1 [L,R=301]
1) The user tries to access my public IP (155.4.32.16) they get redirected to muffy.northernia.com.
2) The user tries to access my Dynu domain (e191374.dynu.net) they get redirected to muffy.northernia.com.
Now the problem begins:
When the user get redirected, Apache adds two slashes and I can't remove them. Example: I access 155.4.32.16/admin/nologon and it redirects me to muffy.northernia.com//admin/nologon. Notice the two slashes.
RewriteCond %{REQUEST_URI} ^(.*)//+(.*)$
RewriteRule / http://muffy.northernia.com/%1/%2 [R=301,L]
What am I doing wrong?
Upvotes: 0
Views: 141
Reputation: 662
The API wrapper for dynu I wrote could be useful to you: https://github.com/adm-github/godynu
Upvotes: 0
Reputation:
Solved it. by default "$1" contains the index path "/".
Changed:
RewriteRule ^(.*)$ http://muffy.northernia.com/$1 [L,R=301]
To:
RewriteRule ^(.*)$ http://muffy.northernia.com$1 [L,R=301]
Upvotes: 1