I am trying to redirect any subdomain of my website to a page by using the subdomain's name as a variable but without the URL to actually change.
e.g.
http://SUBDOMAIN-NAME.website.com
to poing to:
http://www.website.com/view/SUBDOMAIN-NAME
but with the URL staying as
https://soundcloud.com/bugprentice/im-so-tired
I am on an APACHE server and I would like to use .htaccess rules
Related
I'm trying to load content hosted on a subdomain site as a subfolder on the same main domain - I've attempted a variety of IIS URL rewrites with no luck so far. The goal is for a user to go to:
domain.com/subdomain1
which displays
subdomain1.domain.com
but keeps the URL as
domain.com/subdomain1
There are multiple subdomains which I need to do this with.
I have the URL Rewrite module installed and have tried all many of rules.
Any help would be appreciated :-)
A rewrite changes the path on the server only, if you want the URL to change you need a redirect. You can change this on the rule.
I am looking to mask or cloak a URL with a subdomain.
For example, if I have the URL http://example.com/news/article/this-is-an-article it would be possible to visit http://test.example.com/this-is-an-article and the same page would display. Notice: the desired secondary URL is a subdomain of the original URL.
I am using IIS 7. All of the examples I have looked at only change the structure for the existing URL (instead of mapping it to a sub-domain). I am looking for something different to a redirect (perhaps a rewrite, if that is the correct term).
Assuming you are using the IIS rewrite module, there are two main response types: Rewrite and Redirect.
A rewrite takes the existing url and changes it internally within the same site, so that a url that doesn't really exist on the site is remapped to an existing endpoint. The user does not notice the difference, the requested url returns the expected content. This only works within a site.
A redirect is used when you need to return content from a different site (such as in your case). Instead of rewriting the url internally, a 301 or 302 with a new url is returned to the browser. The browser than just requests that new url and gets the content from the second site. The user will notice a change of the url in the address bar.
So you have to use the redirect response type in the rewrite module, only in this case you can specify an absolute URL such as http://example.com/news/article/this-is-an-article
If both example.com and test.example.com are mapped to the same IIS site, you could use a rewrite rule.
for e.g. my domain is www.examples.com and subdomain is test2.examples.com
I am using url variable to link pages.
e.g.test2.examples.com/index.php?page=registers
but I want clean url like
test2.examples.com/page/registers
How can I do this using HTACCESS file.
can I use HTACCESS for subdomain or it will not allow
You are looking for URL Rewriting, it will answer all your needs., see this URL Rewriting Guide
I currently have a WordPress Multi-Site Network set up. The main website is located at "http://safesideinc.com." Then, there is another sub-domain "http://danielgosek.safesideinc.com."
I want the URL "http://safesideinc.com" to lead to "http://safesideinc.com," and the URL "http://danielgosek.com" to lead to "http://danielgosek.safesideinc.com."
Using a 301 Redirect in .htaccess, I can achieve this. However, I would like it so that entering "http://danielgosek.com" in the URL bar leads to "http://danielgosek.safesideinc.com." WITHOUT CHANGING the URL displayed--in this case, the displayed URL should remain "http://danielgosek.com."
Are there any rules that could help me achieve this?
Not possible, a 301 - Permanent Redirect, is an instruction to the BROWSER that the resource has moved permanently and the BROWSER should re-direct to the provided new URL.
If you don't want the URL to change you either need a Reverse proxy set-up between the two virtual hosts / domains, or if danielgosek.com is just an alias, same IP and served from the same Apache virtual host, you could use an internal rewrite.
I have a parked domain www.my-domain.com
I also have a hosted active domain sub.active-domain.com
I want to forward www.my-domain.com to sub.active-domain.com but keeps the url on
structure in the browser from sub.active-domain.com
example:
sub.active-domain.com/content/market.html
will shows on url become
www.my-domain.com/content/market.html
how to do it thru the htaccess file ? or should i do it thru the DNS or CNAME ?
The best way would be with .htaccess.
But you can not keep the url as long as you redirect it somewhere.
Or other wise use a iframe.