I want to allow access to a site outside the company, only via a link on the company site via .htacces configuration on 'www.myside.com'. The code below work to bring me to the site but my CSS, JPG, PNG, JS is not loaded.
<If "%{HTTP_REFERER} != 'https://www.CompanySite.com'">
Redirect / http://www.example.com/
</If>
What should be added/changed to make the site load all scripts etc?
Related
I have no idea how to block entering to a specific file from every one except one website. I Have 2 websites, one with my website and other that I can upload to him any thing I want to. I want to allow image uploading to my website, but really it will upload the image to the other website, using AJAX. But I don't want people to be able to use the AJAX code for their sites too, I want that the other website will allow image uploading (AKA accessing to the PHP upload file) only from the first website.
I do not know how to use HTACCESS, I know only the basic, so here is an a example in PHP (and please help me to 'translate' it to HTACCESS):
<?php
if($_SERVER[REQUEST_URI] == "/images/uploads/EXAMPLE" && $from != "http://www.example.com"){ // $from = from where the ajax request were sent.
header("location: 403.html");
}
?>
You can give this a try, put the content below in your .htaccess file:
SetEnvIf Referer my-domain.com internal
#
<Files *>
order Deny,Allow
Deny from all
Allow from env=internal
</Files>
Put the .htaccess file in website where you upload the image to. My-Domain.com is the domain that you would like to have access to the images.
Note: This is not tested
Hi there on my site i link to a site that has changed the url of the site but uses the original domain to host the images. Is this possible to catch the links via htaccess but no change any of that domain with an image file detected?
So change outgoing link from www.oldsite.com to www.newsite.com but if images detected leave oldsite.com url.
I have too many links to change manually, is this even possible ?
It can't be done using .htaccess . .htaccess is directory level Apache configuration file!
I have a domain e.g. named www.example.com, when people type in example.com, it still can be accessed, but won't automatically add that 'www' to the url.
But as for website like facebook, if you type in facebook.com, it'll automatically add that 'www', BEFORE loading the page for you.
Probably I didn't explain it well, but guess you see the difference and get my point anyway.
So how can I make my domain acts like facebook, when people type example.com, it'll automatically add that www for them?
EDIT:
Ok, so I need a redirect to the 'www' subdomain. Actually I'm using nodejs, which hosted on Amazon EC2, to serve the webpage instead of Apache HTTP. So any equivalent of .htaccess in nodejs area?
I guess now the question shifts to more nodejs oriented, and it turns out it becomes a redundant of this thread:
Redirect all requests using Express 3?
Thanks all for your help.
you have to set your domain 301 permanent redirect in your control panel.
if your website is hosted in CPANEL then
GOTO -> Redirects in ( Domains Menu )
Choose the type Permanent (301)
choose your domain.com
www.domain.com in redirects to→ __
check the box on Redirect with or without www
finally CLick ADD
if your website is hosted in PLESK then
do it in your program level
or
plesk11.0.29 version above supports the 301 peramanent
You can do all of this with a .htaccess file.
https://kb.mediatemple.net/questions/242/How+do+I+redirect+my+site+using+a+.htaccess+file%3F
# This allows you to redirect your entire website to any other domain
Redirect 301 / http://mt-example.com/
Add this in a file named .htaccess on your host, but set it to the URL you want your main page to be.
To make a .htaccess file, you can always go in FTP, upload an empty .txt file, open it with notepad, put in the lines of code above, then rename it to .htaccess.
I would like a website to initially display intro.html when coming from external websites like google, or just from typing in the url. This intro.html and all internal links will link to index.php (wordpress blog so index.php can't change filename) which will then serve as the homepage. Can i do this with .htaccess, perhaps some rewritecond only on external links?
Yes, just redirect every request that does not come from your website, you can check this with HTTP_REFERER. This article should get you on the right path.
I have generated an rss feed in my custom component in my joomla site.
I am using ARTIO SEF in my joomla site for configuring SEF urls, and i changed the SEF url for the rss feed to something like this: http://www.mysite.com/rss.xml
But i am getting a 404 page when i visit that url.
However this url is working: http://www.mysite.com/rss-xml
I am confused at what changes i need to make to my site (or .htaccess file) to make a custom redirect to the rss-xml page when a user visits rss.xml page.
(Note: I am using localhost initially for development.)
Add something like this to your .htaccess file
Redirect 303 /rss.xml /rss-xml