How can you rewrite an internal link access from external hostname? - apache

What if I have some internal links on my xampp web server that need to get accessed by external (requests from the internet)?
Lets say http://mylocalsite.local/login/ is a link on the site.
if I click on this link from http://externalwebsiteaddress.com, which should redirect to my webserver. Can the internal link (mylocalsite) be rewritten to http://externalwebsiteaddress.com/login ? Because currently external requests give a "Cannot access this page error" because its internal.
I don't want the internal link to redirect to the external link when accessed from within the network.
Basically if the links are internal , then find a way to service the request from external website successfully, without having to physically change the link on the server.
in other words
If the user is accessing from an external internet link, then find a way to redirect to proper folder using external link so it can be resolved properly.
EX: All links start with http://externalwebsiteaddress/wherever
If user is accessing from internal (inside the network) , then use the local links.
EX: All links start with http://internaladdress/wherever
Would this be a mod_rewrite? I am confusing myself way to much.

Related

Authenticate before Hitting External URL

I have a site hosted publicly with quite a complex name (including Guid) lets say Site_1, and I have another site hosted publicly at IIS with user friendly name lets say Site_2. I want to redirect my request coming to Site_2 for specific path to Site_1, without showing the address of Site_1 in URL, instead show the URL for Site_2.
On top of that I want to do an authentication before somebody can hit site Site_1, either via Site_2 or via copy pasting a URL for Site_1.
One of the solution that I have applied and achieved successfully is using NGINX Reverse Proxy and its basic or external authentication.
I am looking for example for doing same in IIS or any other platform, or any coding that needs to be done at Site_2.

PHP Web page (code) access security

How do I prevent my page say 'index.php' and all other web pages in different folders on server to be accessed anyone by typing the path in address bar of browser like www.kkweb.com/web/index.php. Kindly help.
If you have php correctly installed and running, they get the parsed site. I.e., they can open the website, but cannot read your source code. If you want to avoid even that, you can implement access protection. Google .htpasswd and .htaccess for that.

Should I allow viewing my website by entering the IP in url bar

Should I allow viewing my website by entering the IP in url bar? that means that instead of writing site.com in the browser, I write the IP of the website.
Example:
this IP 85.17.159.246 is not accessible if you put it in the browser bar. But the website hosted by it azlyrics.com is available.
Google on the hand allows viewing its website via direct IP, for example if you use 64.233.165.190 in your browser it will show Google's website.
Is it bad to allow that? Is it good? Why?
In the past I've read that it is not a good idea to allow this, but now I really don't know how to search for this, as all the results on Google return with irrlevant pages.
If it is not a good idea, how can I block it? (without blocking the website url, of course)
We do have domain names for a reason, it brings several nice benefits as being able to move your site to a new IP but keeping the same domain name. Also when using domain names you can have multiple websites on a single IP.
It's not bad. But an IP can only "host" one site. This works for Google, since they'd only be serving up google.com content anyways. But consider a shared server with (say) 50 different sites on it.
When you punch in http://example.com, your browser will hit example.com's IP and include a Host: example.com in the request's HTTP headers. That lets the server identify which of its sites you're requesting.
But if you hit the server's IP directly, there's no Host: header, and now Apache has no idea which of the sites you really want.

error "List does not exist"

I had error when access SharePoint sites out of the server , as when I
try to add new document or did any action this error displayed although
it worked well in SharePoint server
I think Yevgeniy made a good suggestion.
I assume you mean by 'outside' the server, users are trying to view the page on a different URL? If so, it might be the URLs to access the site 'outside SharePoint' are not configured correctly.
I would suggest a few things to start with:
When you say it works 'in SharePoint server' does this mean that the whole site is accessible, with no problems? But using a different URL (i.e. host header?), fails - for just this one page with the list or the whole site?
Check you have Alternate Access Mappings configured correctly as suggested above - check that the URL is setup correctly in any AAM zones defined, and that the authentication (e.g. Anonymous, Forms whatever required) is also setup too. This is all done in Central Administration.
If AAM setup correctly, check if you have any firewall or other network security that may block access to the site (again, assuming users are routed externally?)
Does the problem page or list (or the subsite it is within) have any unique security permissions?
You can check for the site via Site Actions | Site Permissions - if it does not have unique permissions, you will see a 'This Web site inherits permissions from its parent.' message.
If the List has unique permissions, you can check by going to the list page, and clicking 'Library Permissions' on the Library grouping on the Library Tools section of the ribbon.

Restrict direct folder access via .htaccess except via specific links

I want to restrict access to a folder on my server so that visitors may only access the contents (a web application) via links in the same domain. Can I do this using .htaccess? To be clear, I simply want to prevent direct access to the contents so that visitors are routed through other pages on my website in order to get there.
Sounds to me you want URL rewriting. Rewrite all URLs to point to a single point of entry (i.e. the index page), and have the route set as a GET variable (i.e. index.php?r=css/file.css).
This way, you have complete control over what goes where, and you can include or redirect your users accordingly.