I'm currently struggleing with a website which is scraping my site's content by reading the RSS feed and copying my content to their site.
Their server's IP is 5.175.25.229
What is want to do is locking them out by sending them back to their own website using a .htaccess rule.
Will this rule do the job?
RewriteCond %{REMOTE_ADDR} 5.175.25.229
RewriteRule .* http://www.the-bad-website-stealing-my-content.com/ [R,L]
Related
I'm facing a htaccess poroblem which I can't figure it out by myself.
Let's say I want to host two websites under the same hosting plan. The main website is a Prestashop eCommerce website. The other is a placeholder for another domain name.
For example, there is the main www.myshopdomain.com in the root and www.myutilitydomain.com in a directory called Utility.
Currently, all traffic to www.myutilitydomain.com is redirected to www.myshopdomain.com. What should I do to redirect all traffic for www.myutilitydomain.com to the Utility directory, preferably without any reference to www.myshopdomain.com in the redirected URL? Is it even possible? I know I can create a subdomain, but I need the myutility domain to be accessible directly.
I tried a few approaches and managed not to break the eCommerce site, but for www.myutilitydomain.com I always get Internal Server Error.
My final attempt was this:
RewriteCond %{HTTP_HOST} ^www.myutilitydomain.com
RewriteCond %{REQUEST_URI} !^www.myutilitydomain.com$
RewriteRule ^(.*)$ /Utility/
Your RewriteCondition is not right.
You can only match against URL path in a %{REQUEST_URI} RewriteCond not the host header.
Change it to
RewriteCond %{REQUEST_URI} !^/Utility [NC]
I have an Angular application that pulls in content from a CMS for articles via an API. I want to utilize the XML sitemap generated by the CMS. The CMS is hosted at content.example.com and the Angular site is the www. What I would like to do is catch all .xml requests and load the content site by proxy. What I have in my .htaccess is:
RewriteCond %{REQUEST_FILENAME}
RewriteRule ^\.*?\.xml$ https://content.example.com/$2 [P,L]
However, that is not working. Fairly new to mod rewrite so I am assuming my logic is off. Not finding a lot of examples of this. Any help would be appreciated.
You could write your rule this way
# Only apply next rule when domain is www
RewriteCond %{HTTP_HOST} ^www\. [NC]
# (Proxy) rewrite all xml files to its proxy equivalent
RewriteRule ^(.+)\.xml$ https://content.example.com/$1.xml [P]
Perhaps this is impossible to achieve but this is what I would like:
Keep URL the same but load page from alternative site.
So MY DOMAIN is what is the input URL in my browser.
The website is loaded through SITE DOMAIN with that specific URL
But MY DOMAIN needs to stay visible and not the long SITE DOMAIN URL
With below settings I see the full URL of SITE DOMAIN but I need to keep it at MY DOMAIN. So the full SITE DOMAIN URL needs to be hidden and only show the short MY DOMAIN.
RewriteCond %{HTTP_HOST} ^(MY DOMAIN)$ [OR]
RewriteCond %{HTTP_HOST} ^www.(MY DOMAIN)$
RewriteRule ^/?$ "http://(SITE DOMAIN)/cms/?option=com_content&view=article&id=150&Itemid=516" [R=301,NC,L]
EDIT:
So to be clear about my question:
example1.com
example2.com
example3.com
etc
Always need to show as display.org
But actually loads this page: http://(SITEDOMAIN)/cms/?option=com_content&view=article&id=150&Itemid=516
We recently set our site live after developing it on a temporary URL which looked like this:
214.254.325.33/website.com/
Now the site is live, but the temporary URL has been indexed and we would like all the requests for the temp URL to be re-directed to the correct page, so these:
214.254.325.33/website.com/a-new-page
214.254.325.33/website.com/a-new-page2
214.254.325.33/website.com/a-new-page3
Would become this:
www.website.com/a-new-page
www.website.com/a-new-page2
www.website.com/a-new-page3
Is this possible with HTAccess?
Put this code in your DOCUMENT_ROOT/.htaccess file:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^214\.254\.325\.33$
RewriteRule ^website\.com/(.*)$ http://www.website.com/$1 [NE,R=301,L]
I created a Wordpress blog on http://staging.mydomain.com and now that the website is ready i want all the pages to point to http://www.mydomain.com . I configured Wordpress to do that,the problem is that Google already index http://staging.mydomain.com articles and i want the pages to redirect to http://www.mydomain.com/Name-of-the-article
I search around and found that I need to do a 301 redirection via a htaccess but I don't know what to write.
Thank you for taking the time to read my answer.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^staging.mydomain.com$
RewriteRule ^(.*)$ http://mydomain.com/$1 [R=permanent,L]