Mask a domain inside a folder in one other domain - .htaccess

I need the contents of myseconddomain.com to be displayed in the myfirstdomain.com/folder folder.
And, if I go to myfirstdomain.com/folder/subfolder, to view myseconddomain.com/subfolder.
All without changing the url, but staying on the myfirstdomain.com domain. (Transparently)
I tried to search, but I can't find solutions through .htaccess that could do for me.
Have any of you had similar needs? Could you help me?
A thousand thanks!

Related

Setting up .htaccess for the first time

Totally lost on how to set up a .htaccess file, bunch of stuff and only been able to redirect and set index.
I have a site https://subdomain.domain.com/views/list.html and I want it to show up as https://subdomain.domain.comIve been able to hide the views/list.html from that main page with DirectoryIndex views/list.html but when i come back to it from within the website it still shows up as subfolder.Also is it possible for other subfolder files to not show up as subfolder but as something else? e.g. https://subdomain.domain.com/views/add.html show up as https://subdomain.domain.com/addproduct
Have you thought about trying PHP indexing? Make a folder structure and place the indexer in the correct folder. As for the subbing, it should be possible, least from what I recall.

AGAIN: how to hide subdirectories in browser bar with htaccess

Sorry to bother you perhaps again, but I can't get it working after trying at least 30 answers already given on this subject!!
I use a somewhat deep directory structure and the I would like to rewrite the address browser bar of all subdirectories been replaced by one: simply (www.)example.com/subdirname. Even if I redirect from within the subdirectories to a higher level.
In other words:
So I have: http://www.example.com/subdirname ----> this what I would like to show every time. Here is also my main index.html located.
Then the structure beneath is e.g. www.example.com/subname/text/image/magazine/xxx.html
I have tried all the REWRITE CODES available (well, practically). But nothing works.
Can and will someone please give me the ultimate answer how to code this in htaccess? Please don't forget to tell me please, in which directory I should place this htaccess (allthough I tried all).
By the way, I don't care about SEO - the (sub-)pages don't have to be 'searchable'.
By the way, this is a site which I like to protect a little against theft, since it concerns my living of bookselling.
Thanks a lot beforehand!
Rokus
There is one way to do this, a frame redirect.
That'll always show the same URL in the address bar - but it's trivial to find the actual URL for anyone with the slightest bit of technical knowledge.
Users will also be unable to link to a specific page or magazine.
If you have intellectual property you want to protect, it might be worth looking into other, more suitable ways to do so.

Redirecting a file using a fake folder

I'm trying to redirect a file using a fake folder, but I can not get it to work properly. I've been searching and trying different things but none of them worked out for me.
How my current URL looks like:
/new-weblog.php
How I want the URL to look like:
/weblogs/new-weblog.php
I do not want to redirect ALL urls to have the fake /weblogs/ folder. Only just for that one specific file.
Thank you in advance.
This doesn't qualify as an answer, however, this is a good tutorial that will give you the desired solution you're looking for and teach you about htaccess commands while you're at it.
Here's the link: https://www.addedbytes.com/articles/for-beginners/url-rewriting-for-beginners/

Removing forward slashes after a particular subfolder section in a URL address

I have a networking site that has member data organised into subfolders. To access the data, a user would need to go to something like:-
www.domain.com/members/so/me/on/esfolder
My question is, can I use a function in the .htaccess file to allow users to visit the same page by just typing:-
www.domain.com/members/someonesfolder
I have read up on the Rewrite syntax but struggling to understand how to do this. It is simply a case of removing the forward slashes after a particular point.
Any ideas? Thanks in advance.
I've figured it out myself after a non-stop mess around lasting several hours... For those who might want to know, here is the code I used...
RewriteRule ^members/([A-Za-z0-9]{1,2})([A-Za-z0-9]{1,2})([A-Za-z0-9]{1,}) members/$1/$2/$3/ [L]
In the above, there is just three sub-folder drill downs (which is what I have decided to do rather than the four in my original question).
Hope this helps someone else!

.htaccess or symbolic link (symlink)

I have a website with multiple folders and I was trying to fix them in my .htaccess. After a little while, I have a big .htaccess with rules that conflicts.
Now every time I want to add a folder I have to add it to the .htaccess.
I did some research and I found out I can create symbolic link instead, so no more .htaccess
In both solution I have to create or modify something so for me its the same result at the end but is it a better practice to create instead symbolic link ?
Symbolic links are faster yes (like Aki said) but here's my thoughts on this.
if you have images, css or js files then you don't need to rewrite or create symbolic links. You can use the full URL (eg /images/...) or use a common domain like i.domain.com (or anything you want) and refer all your JS, Images and CSS there. Eg: i.domain.com/logo.jpg or js.domain.com/site.js.
This way, you never have to think about rewriting rules or create links you might forget one day.
This one is very easy to manage and maintain if you need to add images, change js or update your CSS since you only have one point of entry and automatically everything be updated.
use symblink, .htaccess has to be proccesed by apache whereas the symblink are proccess by the OS which is faster.
creating 100 rules vs 100 symblink, if the rule you looking for is at the last you will have to parse all of them then use the one you need.

Resources