I've been having a lot of trouble with setting up an Alias for my Virtualhost.
I have 2 different codebases that need to be on the same server, I have the admin app as well as the client app.
My virtual host is as follows :
<VirtualHost *:80>
DocumentRoot "E:/xampp/htdocs/site/client"
ServerName local.site.com
Alias /admin/ E:/xampp/htdocs/site/admin/
</VirtualHost>
My folder structure is as follows :
site
- admin
- client
Everything works fine as far as the client goes, I can hit everything under the subdirectory.
The issue arises when I try to hit local.site.com/admin. It redirects the URL to local.site.com/admin/index.php/index.php... and so on (there is like 10 of them).
I also can not hit the index.html in the admin folder directly.
The result I expect is for all traffic to /admin to be directed to the admin folder.
I can not for the life of me figure out why the redirect is happening.
I do not have any .htaccess files in the folders for what its worth.
Any help would be appreciated.
Thanks
Related
I have been running a co-located Linux box with several httpd vhosts. A few years ago I recovered an archived web site and added it to an existing domain as a directory under htdocs as a sub-site. It is an older site that uses frames but works correctly underneath the main domain.
The old website has nostalgic value to certain hobbyists and a couple of weeks ago I decided to acquire another domain so that this sub-site could be accessed directly. However, the frames do not get set up correctly and the pages do not display like they should - stuff is obviously missing.
I have tried several things but no avail. Currently both domains point to the same location.
Here is my Apache config for the main site (http://www.vintagewargamingfigures.info/):
<VirtualHost 64.182.125.197:80>
ServerName www.vintagewargamingfigures.info
ServerAlias vintagewargamingfigures.info
DocumentRoot /local/web_sites/vintage/htdocs
</VirtualHost>
Here is the config for the sub-site when it fails (http://www.vintage20mil.com/):
<VirtualHost 64.182.125.197:80>
ServerName www.vintage20mil.com
ServerAlias vintage20mil.com
DocumentRoot /local/web_sites/vintage/htdocs/rblack
</VirtualHost>
The document root shows the site as being in a directory (rblack) under the main site.
Google Chrome has fooled me a couple of times and it looks like it was working but sometime later it will not work. So, I also use MS Edge to test it.
I have tried several things, including running some symbolic links directly to the rblack directory but haven't found the cure yet.
What am I missing? I suspect it is something simple but it is eluding me.
Any help appreciated.
.......CG
I have two servers running Apache2, one with an associated domain name, let's say "www.home.com" and another one only known by its IP address, let's say 10.11.12.13.
On www.home.com I have three web sites, configured through aliases in apache.
I have http://www.home.com, http://www.home.com/school, http://www.home.com/work.
All these sites are on the server www.home.com.
On 10.11.12.13, I have only one site, accessible by http://10.11.12.13/wiki
How can I configure apache to have http://www.home.com/wiki working but transparently (not changing URL) call http://10.11.12.13/wiki site ?
In other words, the user shall only see www.home.com/wiki/xxxxx when he uses the wiki.
What I have done:
On www.home.com : i have added a wiki folder with nothing in it, and an alias for www.home.com/wiki to work properly.
Then I have tried to use mod rewrite to replace 10.11.12.13 by www.home.com but that does not work, and I am not even sure to do it the right way.
For your information, mod rewrite is configured and works properly on both servers.
Someone could please help me on that ?
Maybe mod rewrite is not the right solution ?
Thanks !
Sam
I finally found a solution : the mod_proxy along with tags.
The conf that worked for me:
<VirtualHost *:80>
[...]
ServerName www.home.com
<Location /wiki>
Allow from all
ProxyPass "http://10.11.12.13/wiki"
ProxyPassReverse "http://10.11.12.13/wiki"
</Location>
</VirtualHost>
I have this site that needs to be inside our secure network that my work uses. I would like to redirect the users when they are trying to access the page to this secure path. For example, If someone tries to access mydomain.com/pictures I want apache to take them to https://mycompanysecure.com/,ThisSite=mydomain.com/pictures,SSL. I want the whole entire site to be redirected like the example above. I think I need to use wildcards, but I am really new on Apache and I don't know how to do this. I want also want also to make it the default when my app launches it always stay like that. So far I was only able to do this with the root path.
This is what I have so far:
<VirtualHost *:80>
ServerName mydomain.com
redirect / https://yourcompany.net/,ThisSite=mydomain.com,SSL
</VirtualHost *:80>
You can capture and substitute the URL by using RedirectMatch:
RedirectMatch ^/(.*) https://yourcompany.net/,ThisSite=mydomain.com/$1,SSL
I have an apache server with some websites built in Wordpress, using vhosts.
The thing is that I have for all of them a configuration like:
ServerName site1.com
ServerAlias www.site1.com
When I access to Site1 through "site1.com" the URL changes to "www.site1.com". The same for Site2, Site3, etc. But for SiteN it's inverse. If I access to "siten.com" it keeps the URL and if you go to "www.siten.com" it changes to "siten.com".
I know I can change this using htaccess file, but my doubt is why some sites has a default and the new site has another default? All the htaccess have the same things and the vhost configuration is the same for all.
Thank you,
Done! The change should be implemented in Wordpress configuration, is not a htaccess issue
First of all, sorry if I got the term 'pseudo subdomain' wrong.
what I am trying to achieve is this-
When someone registers on my application, they get a new url like..
yourname.myapp.tld
I dont want to use the subdomain system for this. To be frank, I dont know how the subdomains exactly work but it guess it requires a folder per subdomain inside the document root and then the server redirects the requests there.
Can this be achieved by doing something like -
when a visiter types any subdomain, (anything.myapp.tld), he is able to access myapp . In the index.php file i will explode the $_SERVER['HTTP_HOST'] to get the subdomain which i will store in session and will thereafter act as an identifier for that user. Ideally i wouldnt want to create any vhosts or add many lines to the hosts file. Can this be achieved with just one vhost?
Is this possible with mod rewrite or something ?
Yes you can archive this using wildcard that needs to be configured on both, the dns server and http server
On the dns a entry like this (installing dns on ubuntu https://help.ubuntu.com/10.04/serverguide/C/dns.html):
; wildcard subdomains are all directed to this IP
; of course this should be the IP of your web server
*.domain.tld. IN A 1.2.3.4
At apache an entry like this:
<VirtualHost 111.22.33.55>
DocumentRoot /www/subdomain
ServerName www.domain.tld
ServerAlias *.domain.tld
</VirtualHost>
What happens after is that everything.domain.tld will be going to your main folder so you can use the index.php to redirect it to the right place or even an htaccess using mod_rewrite.