Say I have a webserver data.mydomain.org.
Right now the webserver has an index.html with a redirect to info.anotherdomain.com.
In addition to providing a redirect, the server has other content like an images folder and a documents folder. These have to remain operational.
My DNS is GoDaddy. If I get on GoDaddy and add a CNAME of info.anotherdomain.com to data.mydomain.org , what happens to the subfolder paths? Will the CNAME make the subfolder paths resolve from lets say data.mydomain.org/images/image1.jpg to info.anotherdomain.com/images/image1.jpg? Or would subfolders be unaffected?
My goal is to get rid of the current index.html redirect and also have the page at info.anotherdomain.com come up in the address bar as data.mydomain.org
First of all DNS doesn't redirects it just route. So you will need the CNAME record to could even reach that subdomain.domain.tld.
But the redir, handling of folders and anything else must be performed from the HTTP server side.
Related
I'm new to HAPROXY's advanced ACLs and I need your help.
I would like to create a redirect based on the subdomain used.
Example :
I have one directory per site on my host.
If someone enters the URL https://test1.test.com, I would like them to be redirected to the test1 directory on the host.
The directory on my host will always be identical to the subdomain.
Example :
https://test2.test.com --> folder /test2
https://test3.test.com --> folder /test3
I would like to create a general rule that redirects to the right folder depending on the subdomain.
I don't know if I was clear enough?
Thank you in advance for your help.
yesterday i switched my sites to a new server. now i have a problem, because one domain i now run as a subdomain, was previously accessed as a subfolder and a few sites, which I have no access to, are still using that domain.com/subfolder/?some=parameters
so, long story short:
i need to update my nginx config file, to redirect my users from domain.com/subfolder/?some=parameters to subfolder.domain.com/?some=parameters
i searched for a solution for that problem yesterday, but couldn't fix the problem.
currently i have this in my conf file:
location /subfolder/ {
rewrite ^/subfolder(/.*)$ http://subfolder.domain.com$1 permanent;
}
which obviously redirects all requests from domain.com/subfolder/?some=parameters to subfolder.domain.com/?some=parameters, but requests to domain.com/subfolder/styles.css aren't redirected.
I think this is due to a conflicting location directive for specific static file extensions in your nginx config. I was able to get your rule to work by making it use a regular expression which influences the priority.
location ~ /subfolder/.* {
rewrite ^/subfolder(/.*)$ http://subfolder.domain.com$1 permanent;
}
See the details about the location directive, especially the rules and examples there about precedence.
I have a subdomain named: www.childsite.com which is a subfolder of www.mymainsite.com
I have created a subfolder called "dashboard" and put it in the domain folder, so I can access that using www.mymainsite.com/dashboard without any problems.
What I really wanted is to put the "dashboard" folder in the subdomain (www.childsite.com)
so the folder structure for that would be:
mymainsite.com
- childsite.com
-dashboard
but when i accessed the wwww.childsite.com/dashboard it gives me a "page not found" error...
In IIS:
Create a folder out site your root directory, if possible. Call it childsite. In your DNS, you will have to set a CName record for childsite.mainsite.com. On your server, if you are running IIS, create a new site with the host name set to childsite.mainsite.com. The root directory for this new site should be the folder you named childsite. If your folder named childsite isn't located in the root directory of mainsite.com then the users cannot access it by going to mainsite.com/childsite/ Simply put the folder dashboard within the childsite folder and you should be all set one the DNS records take effect. (If you're not hosting the DNS yourself.)
I'm dealing with an annoying problem. I have to make some changes to a large website, which source code is not under my control (sub-contracting). As usually I try to rebuild a local copy of the site to test my changes. The problem is now that almost all paths used in URLs for images, css, links etc. are relative paths pointing to the root directory, like
href="/style/main.css"
This is a problem because I develop on an intranet server and I put this project into a nested directory, so the URL to the project files is sth. like
http://myIntranet.com/checkout/project
What happens is that the paths from the first example don't resolve correctly. So I tried using the base tag to set the directory from which links should be resolved as
That works fine when the path is
href="style/main.css"
without the slash at the start, but fails when the slash exists, because (I think) the link is resolved from the server host, not from the URI in the tag.
So... is there any possibility to make the "/dir/file.html" links resolve from a root othe than the server root? Or do I have to manually remove all prepending slashes from the paths (urgh)?
Thanks in advance. :)
If you're doing local development on a web site you can do either of the below. Both involve moving your project in a base folder instead of working with sub folders inside your document root.
Virtual host on different port
In your web server, create another listening port and virtual host.
After restart, you can access your web server as http://localhost:81 or whatever port number you choose.
Virtual host on same port
Only create another virtual host (like above), but make sure to use named virtual hosting.
After restart, you have to add another entry in your hosts file (c:\windows\system32\drivers\etc\hosts or /etc/hosts) using a simple text editor:
127.0.0.1 localhost myproject1.self.com
The above line should already exist, so you can keep adding more names to it:
127.0.0.1 localhost myproject1.self.com myproject2.self.com
Personal preference
I like the second option, because I don't have to mess with ports and stuff like Facebook API keeps working as you expect.
I hope this all makes sense, let me know otherwise.
I have setup TYPO3 successfully on my local server. But I am having problem when clicking on any menu item: It's showing "url not found on server".
When I type in the URL manually into the browser it shows the page. It's only having problems when redirecting after clicking on a page item at any frontend website page.
That might be related to the domain config or RealURL... or both ;)
Do you use RealURL? Or do you use the standard url config?
If links to sub pages look like index.php?id=12345 you are using the standard config.
My guess is that the local DNS ("hosts file") is not configured correctly.
With the hosts file you can simulate how the web site will appear when it's online, hooked up to a "real/global" DNS. (Not quite, but in a nutshell)
So if you set up Typo3 to be reached under http://www.example.com/ you need to tell your local DNS ("hosts file") to route a request to http://www.example.com/ to your local host e.g. http://127.0.0.1/ . In that case your host file needs an entry like so:
127.0.0.1 http://www.example.com/
What Domain do you enter to reach your web site? Where do the links from the menu link to?
If you wanna know mor about the "hosts file" look here:
http://accs-net.com/hosts/how_to_use_hosts.html
If you can log in into the TYPO3 backend (/typo3/) and can access the frondend through /index.php, but not through the generated menu links, then RewriteRules for mod_rewrite don't apply.
Usually TYPO3's installer should detect this configuration and disable RealURL, which is responsible for generating such nice looking URLs (instead of index.php?id=123). It seems like this failed (or you copied everything afterwards without the .htaccess file?).
Make sure that you have TYPO3's .htaccess file in place in the root directory of your installation. If this is the case, make sure that mod_rewrite is enabled in your Apache config.