URL masking with .htaccess - .htaccess

If a visitor of my website open http://www.example.com/pat/to/hi.html, can I show him something different in the address bar with .htaccess, like http://www.example.com only?
Thanks in advance!

Related

htaccess redirect on url with a particular character inside

I have a website with a lot of wrong urls that Google can't indexize and i need to redirect them to the right url in .htaccess
This is the wrong url:
https://example.com/product/right-title/#ALOT-of_crap_9788839550972-queue
and i need to redirect to
https://example.com/product/right-title/
I have no idea how to do it, could somebody help?

Need help redirecting one website URL to another with apache2 and .htaccess

I have two domains - https://hosting.opensimcity.org, and http://paradigm.pocketmud.com and I want to redirect the latter to the former. That is, when someone connects to http://paradigm.pocketmud.com I want it to redirect to https://hosting.opensimcity.org/paradigm
Any tips on doing this in my .htaccess file?
Just try the following htaccess redirect code:
Redirect 301 / https://hosting.opensimcity.org/paradigm
This 301 redirect response notifies the search engines that the page has moved permanently from the old URL to the new URL. The search engines also transfer the old URL page rank to the new URL.

.htaccess - redirect user to subdomain without changing address bar

I want to redirect visitors who go to www.example.com to www.sub.example.com, however their address (url) bar should remain the same - www.example.com. Is it possible using .htaccess or some other method, please? I'm pretty new to this. Thanks!

Can't figure it out: Redirection showing old url

I'm using cpanel and tried using htaccess and it's not working.. I need to redirect prismafoto.com.ar to brujaurbana.com.ar/prisma but when it does the url that is shown is brujaurbana.com.ar/prisma
How can I do this?? thanksss :(
Sounds like you are wanting to do a masked URL redirect. Meaning, you want the domain to redirect but stay the same in the URL bar.
http://webstarthelp.com/forwards.html
The above site has a great Masked URL Redirect.
Simply create a index.html file on prismafoto.com.ar and paste the generated code.
Make sure to clear the .htaccess file so redirects do not conflict.

How to mask a URL in a website?

I want to "mask" a URL. I have a subdomain that I do not want people to know about on my website. So what I am needing help with is this:
My website is: www.example.com
I have a subdomain: sub.example.com/test.php
When someone clicks on a link that points to sub.example.com/test.php, I do not want "sub.example.com/test.php" to show in the url bar. I would like for www.example.com to show instead.
When you want to link to sub.example.com/test.php, change the link to something else, like www.example.com/sub/test.php or something. Then in your .htaccess file in the document root for www.example.com add this:
RewriteEngine On
RewriteRule ^sub/(.*)$ http://sub.example.com/$1 [L,P]
This will internally proxy any request for www.example.com/sub/ to sub.example.com. So when someone requests http://www.example.com/sub/path/file.html, they really get http://sub.example.com/path/file.html except their URL address bar still has the example.com URL. You just need to make sure to change all of your links to sub.example.com to example.com/sub/

Resources