简体   繁体   中英

need to correct a RewriteRule for joomla htaccess

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM