|
|
||||||
|
||||||
| Index Link To US Private Messages Archive FAQ RSS | ||||||
| IT Discussion Forum Having IT issues? Got IT questions? Who doesn't? If you can't get your Apache to work with your MySQL or your php is choking on your ODBC... Let's see if we can help you come up with some ideas. |
Share Thread: & Tags
|
||||
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi all. One of my webpages has been hijacked, and of course as always
google has rewarded the hijacker by REMOVING my top ranked 10 year old URL from their index and then ADDING the bogus URL in their index, which shows for no searches! The URL now has a strange thing appended to the rear: ?ref=pislikcs.com I have been trying to do a 301 redirect from that URL to the REAL URL, but I can't! I've tried through cPanel's URL Redirect area and it won't work. It won't even get added! I then tried manually adding it in my htaccess file, but it still won't work! So obviously the "?" is screwing up something, so can anyone please tell me how I redirect: domain.com/page.html?ref=pislikcs.com TO: domain.com/page.html Thanks, -Clint
__________________
God Bless -Clint |
|
||||
|
I came across the same issue. What worked for me was {QUERY_STRING}
In your example I "think" something like... RewriteCond %{QUERY_STRING} ref=pislikcs.com RewriteRule \page.html http://www.domain.com/page.html? [R=301,L] ...might work. Perhaps one of the better coders can help out on this. Dave |
|
||||
|
If you use the HTAccess file,to do this, it will work perfectly
Quote:
|
|
||||
|
Yes it will, i had a Joomla site on a domain name until a few weeks ago, when i changed its domain name, and needed to redirect the urls to the new site, so if anybody found the products in google, it would be redirected, so i made this htaccess file.
HTML Code:
redirect 301 /vr.html http://www.mysite.co.uk/index.php/ice-sculptures/ice-sculpture-movies redirect 301 /testimonial.html http://www.mysite.co.uk/index.php/testimonials redirect 301 /vr-elephant.html http://www.mysite.co.uk/index.php/ice-sculptures redirect 301 /contact.html http://www.mysite.co.uk/index.php/contact-us redirect 301 /nicolewedding.html http://www.mysite.co.uk/index.php/testimonials/ice-wedding-cake redirect 301 /vr-fish.html http://www.mysite.co.uk/index.php/ice-sculpture-movies/1-sculptures/20-ice-fish-sculpture redirect 301 /vr-elephant.html http://www.mysite.co.uk/index.php/ice-sculpture-movies/1-sculptures/19-ice-elephant-movie redirect 301 /clients.html http://www.mysite.co.uk/index.php/our-clients redirect 301 /products.asp http://www.mysite.co.uk/index.php/gallery redirect 301 /sub.asp http://www.mysite.co.uk/index.php/gallery You could also do this with none sef urls, so you just need to know what the url is it is trying to pick up, for example HTML Code:
redirect 301 //index.php?option=com_virtuemart&page=shop.browse&category_id=2&Itemid=3 http://www.google.co.uk Last edited by da8iwr; 10-13-2008 at 06:38 PM. |
|
||||
|
Sorry Clint1, just realised you put the URLs you want to change from and to.
HTML Code:
redirect 301 domain.com/page.html?ref=pislikcs.com domain.com/page.html |
|
||||
|
Try adding this code to your header:
<script type="text/javascript"> if(top!= self) top.location.href = self.location.href </script> More information about Hijacking below: Quote:
|
|
||||
|
My personal opinion will be finding out the source of the problem and rectify it instead of using redirect. This will be a permanent solution.
If you have done a backup of your website, simply delete the entire site and re-install it again. At the same time, you must try to find out where is the security breach so you can plug the hole otherwise it will happen again and again. |
|
||||
|
As far as I can tell, the only way to do this reliably is with mod_rewrite, as Dave showed above. I would just alter that code slightly so that it should work for any page on your site. I think the following should work:
Code:
RewriteCond %{QUERY_STRING} ref=pislikcs.com
RewriteRule ^(.*).html$ http://example.com/%1.html [R=301,L]
This should take the entire URL up to the .html extension and replace it in a redirect without a query string. The rewriteCond directive should ensure this is only done for ref=pislikcs.com so that other query strings on your site will still work.
__________________
The best way to learn anything, is to question everything. Interestingly Average Security Blog |
|
||||
|
Ok, I have come to realize that the code I gave won't work for the root page of a folder (ie domain.tld/). The following code should work in all cases:
Code:
RewriteCond %{query_string} ref=pislikcs.com
RewriteRule (.*) http://www.example.com/$1? [R=301,L]
__________________
The best way to learn anything, is to question everything. Interestingly Average Security Blog |
|
|||
|
Quote:
As you can see, the page name is duplicated! It puts a slash on the end, the duplicates the page name. I tried both of these: RewriteCond %{query_string} ref=pislikcs.com RewriteRule (.*) http://www.domain.com/page_name.html/$1? [R=301,L] AND: RewriteCond %{query_string} ref=pislikcs.com RewriteRule (.*) /page_name.html/$1? [R=301,L] And I also tried removing the / after "html". BTW, there's a question mark you left out, I don't know if that matters. The invalid bad appending data is ?ref=pislikcs.com
__________________
God Bless -Clint |
|
||||
|
The question mark should be removed from the first line, as the QUERY_STRING variable only contains what is after the question mark.
If the first one is causing duplication, I would check what other rewrite rules you have enabled, because what may be happening is that two conflicting rewrites are happening. Make sure those two lines are the first thing in the .htaccess file, after any RewriteEngine on directive. The L at the end will ensure that no other rewrites are processed after it. EDIT: I see what the problem is. The first version has the page name stated explicitly. Change the first one from this: RewriteCond %{query_string} ref=pislikcs.com RewriteRule (.*) http://www.domain.com/page_name.html/$1? [R=301,L] to this: RewriteCond %{query_string} ref=pislikcs.com RewriteRule (.*) http://www.domain.com/$1? [R=301,L] (removing the bolded part)
__________________
The best way to learn anything, is to question everything. Interestingly Average Security Blog Last edited by wige; 10-15-2008 at 03:36 PM. |
|
|||
|
Nice to see this site back up! What's been going on, every time I'd come here to try and read the replies the site was down. So I'll be trying these methods today and report back. Thanks again guys.
"Edhan", as you may know, G refuses to tell you from where IBL's originate for an inside URL. I searched for the bogus URL in G and found nothing (other than of course the bogus URL). But in Y's Site Explorer I could at least see who's linking to the URL, but not a single one was using the bogus URL, all of the IBL's to that page were legit using the correct URL.
__________________
God Bless -Clint |
|
||||
|
Yes. I am having problems with this site at times. Seems like it is getting 'hot' as I can't login at times.
Well, as I have said, I like to settle the source of the problem. Since you can't find out where is the root of the problem, you can only resolve using redirect 301. This may happen again with other url link but then you have no choice but resort to redirect until you can find the source of the problem. |
|
|||
|
Dave, thanks but this below ruined the page! Now this is urgent. I even removed it from the htaccess file and the page is still totally blank! But the source code is still there! Yes, my cache is totally cleared when I close IE, so why is the page still blank after removing the code from my htaccess file??
Quote:
__________________
God Bless -Clint |
|
|||
|
Ok I see what the problem was, I tried this code below around the same time and it didn't work, and when I removed it I obviously removed part of some JS that was needed in the head tag.
Thanks but that didn't do anything.
__________________
God Bless -Clint |
|
|||
|
Quote:
Thanks.
__________________
God Bless -Clint |
|
|||
|
Quote:
WTF?? I had to edit that, http: //www. without the space showed as "Hiring Center | Powered by Monster.com"!!!!
__________________
God Bless -Clint Last edited by Clint1; 10-25-2008 at 09:31 AM. |
|
|||
|
Quote:
__________________
God Bless -Clint |
|
|||
|
Quote:
Now regarding what could be causing these suggestions NOT to work: I have "Hot Link Protection" enabled, and these redirects: --------------------- RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html RewriteRule ^index\.html$ http://www.domain.com/ [R=301,L] RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC] RewriteCond %{HTTP_HOST} !^$ RewriteRule ^(.*) http://www.domain.com/$1 [L,R=301] ----------------------- That first one is because (guess who) was hitting on my homepage and putting an "index.html" page on it and calling it duplicate content! So I was forced to create that redirect thanks again to G. The second is just a non-www to www version redirect. Then these: --------------------- Options +FollowSymLinks Options +SymlinksIfOwnerMatch RewriteBase / RewriteRule ^pc-cillin/(.*) http://www. trendmicro .com/vinfo/virusencyclo/default.asp Options +FollowSymLinks Options +SymlinksIfOwnerMatch RewriteBase / RewriteRule ^vinfo/(.*) http://www. trendmicro .com/vinfo/virusencyclo/default.asp ---------------------------------- I had to create those because (once again, GUESS WHO!) was putting MY domain as the Trend Micro domain on numerous Trend Micro SUB-pages when the Gbot would spider my virus info pages which have a feed on them from Trend. Then I have few redirects for old URL's done via cPanel to new URL's that are similar to this: RewriteCond %{HTTP_HOST} ^.*$ RewriteRule ^OldPage.html$ "http\:\/\/www\.domain\.com\/New_Page\.html" [R=301,L] Now that may be the problem because that is the URL that's been affected by this ?ref=pislikcs.com problem! Now if that is the cause, then how can that redirect be Incorporated into the new one I now need? I also have some IP Deny's listed in the htaccess file, but I'm sure that wouldn't affect anything. Also, should the "RewriteEngine on" be at the VERY TOP of the htaccess file, or does it matter? It used to be right before the redirects began in the file, but recently "it moved" for some reason to the very top ABOVE the IP's listed for the IP Deny area. I have since put it back below the "IP Deny" IP's listed and right before the first redirect. Thanks. EDIT: I HATE the way this website screws up URL's and creates text links for them! So this time I had to go and put spaces in the Trend Micro URL's so they could be seen!
__________________
God Bless -Clint Last edited by Clint1; 10-25-2008 at 10:00 AM. Reason: noted |
|
|||
|
BTW, I did try using one of the existing cPanel redirects to change the HTTP_HOST to QUERY_STRING and that didn't work.
__________________
God Bless -Clint |
|
||||
|
This ruleset:
RewriteCond %{HTTP_HOST} ^.*$ RewriteRule ^OldPage.html$ "http\:\/\/www\.domain\.com\/New_Page\.html" [R=301,L] is not needed and can be replaced with something more effective that requires less overhead: Redirect 301 oldpage.html http://www.domain.tld/New_Page.html Generally, I try to avoid the use of mod_rewrite except where I am doing internal rewrites. Because of the pattern recognition components of the mod_rewrite system, each rule adds significant overhead to the server software which results in a slight reduction in performance - although slight it can add up. Also, most webmasters are not overly familiar with regular expressions, and unexpected conflicts can occur between mod_rewrite rulesets as a result. The RewriteEngine on directive needs to be before the first RewriteCond or Rewrite Rule directive. Beyond that, it's placement should not matter. If you want, send me a copy of your .htaccess file in PM and I can take a look, see if I can spot where the conflict might be.
__________________
The best way to learn anything, is to question everything. Interestingly Average Security Blog Last edited by wige; 10-28-2008 at 09:22 AM. |
|
||||
|
Quote:
Clint... Here's the first few lines I'm using and it works fine... Code:
RewriteEngine on
RewriteCond %{QUERY_STRING} Category=210
RewriteRule Category\.asp http://www.chainzonline.com/saint-monica-medals.html? [R=301,L]
RewriteCond %{QUERY_STRING} Category=209
RewriteRule Category\.asp http://www.chainzonline.com/saint-miguel.html? [R=301,L]
|
|
|||
|
Dave, where's the old URL and new URL in your code? Or is both of those areas one redirect and both URL's (old and new) have the ? in them?
__________________
God Bless -Clint |
|
|||
|
Quote:
Redirect 301 /oldpage.html http://www.domain.tld/New_Page.html That's just the way cPanel does the redirects, but if you think that method is better than theirs, then I'll change all of mine to that method. Thanks. Quote:
Quote:
__________________
God Bless -Clint Last edited by Clint1; 10-29-2008 at 10:01 AM. |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| ASP dynamic 301 redirect based on Product ID | rumblepup | Web Programming Discussion Forum | 11 | 04-28-2007 07:38 AM |
| 301 Redirect on dynamic site | netfrugal | Search Engine Optimization Forum | 1 | 10-03-2006 08:05 PM |
| 301 redirect for dynamic site | b2bseo | Google Discussion Forum | 0 | 09-09-2005 02:45 AM |
| Dynamic URL question | curtbro | Search Engine Optimization Forum | 3 | 01-24-2005 06:31 PM |
| newbie question on dynamic pages | ralf_the_cat | Web Programming Discussion Forum | 2 | 11-24-2003 01:10 PM |
|
WebProWorld |
Advertise |
Contact Us |
About |
Forum Rules |
MVP's |
Archive |
Newsletter Archive |
Top |
WebProNews
WebProWorld is an iEntry, Inc. ® site - © 2009 All Rights Reserved Privacy Policy and Legal iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509 |