Reputation: 1
So someone in china keeps redirecting peoples browsers to a copy of my site. Here is how i found out.
I have a joomla installation where someone posted a message on the forum. Usually the email i get is Hey someone posted a message..... heres the topic link
www.antifmradio.com/
link somewhere in the site forum
ok all great but today i get an email with this instead
http://122.72.0.7www.antifmradio.com
So this http://www.antifmradio.com
was changed to this
http://122.72.0.7www.antifmradio.com
Ok so here is what i did. I created this rewrite rule
RewriteCond %{HTTP_HOST} ^http://122.72.0.7www.antifmradio.com [NC]
RewriteRule ^(.*)$ http://www.antifmradio.com/$1 [R=301,L]
Now no matter what you do, if you try going to the 122.72.0.7 link you will always end up correctly at my correct domain
awesome!
Now this only works in my ROOT folder of my domain, i need to know how to write this so it works in my joomla directly.
Joomla has its own htaccess file and i am using. But i dont know where to place this rewrite rule in there.
Also in my domain root folder i tried doing this so it would recognize joomla folder too
RewriteRule ^(.*)$ http://www.antifmradio.com/$1**/$1** [R=301,L]
but that didnt work by just adding the additional /$1
to the end
Upvotes: 0
Views: 191
Reputation: 143886
You need to hardcode the name of your joomla folder:
RewriteCond %{HTTP_HOST} ^http://122.72.0.7www.antifmradio.com [NC]
RewriteRule ^(.*)$ http://www.antifmradio.com/joomla_folder_name/$1 [R=301,L]
And you'll want to add that before any other rules you may have in your joomla folder's htaccess file.
Upvotes: 1