How to map localhost to project directory [closed] - apache

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
Currently I placed my project in /www directory of my Apache2 server, and I can access this project by localhost/abc
However I want localhost to map to this project, what should I do in order to make localhost to map to my project?

You could try this in /etc/apache2/httpd.conf or similar (it's specific to your OS/distro). I don't run Apache locally, so not sure if something like this could work.
<VirtualHost ip:port>
ServerName localhost
DocumentRoot /www/your_project
</VirtualHost>

If you don't have access to httpd.conf you could put this into the .htaccess file:
RewriteEngine on
RewriteRule ^/$ /abc/
http://httpd.apache.org/docs/current/rewrite/remapping.html
Good Luck!

Related

Configuring apache2 [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I have a unbent server with apache2 on it and in: /etc/apache2/sites-available I have the file: adambalan.conf which looks like this:
<VirtualHost *:80>
DocumentRoot /home/*****/WordPress
ServerName adambalan.com
</VirtualHost>
I then did:
****#localhost:/etc/apache2/sites-available$
sudo a2ensite adambalan.conf #=> Enabling site adambalan.
One The site is adambalan.com not adambalan.
So I thought, ok ill just restart apache like it told me too ...
When I do and try and go to adambalan.com I don't get my Wordpress stuff, which is all set up[ and ready to go. All I get is the typical - omg apache works. So I don't think the virtual host worked.
Ideas?
I am assuming the main httpd.conf has NameVirtualHost *:80. If not, please add.
Eventhough you are connecting to http://adambalan.com, your browser may be connecting to http://www.adambalan.com if the DNS resolves www.adambalan.com but not adambalan.com.
To cover your bases, use ServerName and ServerAlias in adambalam.conf.
ServerName adambalan.com
ServerAlias www.adambalan.com
Give it a try.

url rewrite `/abc/products-` to `/def/products-` [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have many url links in /abc/ sub-directory, like
http://www.domain.com/abc/products-12345
http://www.domain.com/abc/products-23456
http://www.domain.com/abc/products-34567
http://www.domain.com/abc/new-items
Now I want to url rewrite /abc/products- to /def/products-
http://www.domain.com/def/products-12345
http://www.domain.com/def/products-23456
http://www.domain.com/def/products-34567
http://www.domain.com/abc/new-items
My code in .htaccess, but nothing changed. How to rewrite in this case? Thanks.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^abc/products-(.*)$ /def/products-$1 [L,R=301]
</IfModule>
As you can test on this simulator the rules should work.
The most probable problem you are facing should be:
The global configuration does not allow for .htaccess overwrite
.htaccess is not readable for apache user
You have no mod_rewrite active on this apache server, thus no trigger to <IfModule> directive.
Best troubleshooting option would be trying a redirection of all page to a static page. If this does not work, look for a configuration problem.

How to redirect C:/xampp/htdocs/myfolder to C:/somewhere_else? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
I installed XAMPP and have an apache server running. My files are located on C:/xampp/htdocs and are acessible from a www.mydomain.etc, but I would like www.mydomain.etc/foo to be read by C:/somewhere_else instead. How is this possible?
Enable mod_alias and add this to httpd.conf:
Alias /foo c:/somewhere_else
You just go into your httpd config file, which probably is located at something like this:
C:\xampp\apache\conf\httpd.conf
Open it, and do the following changes, change to your new directory.
Change the lines:
.
.
DocumentRoot "C:/xampp/htdocs"
.
.
<Directory "C:/xampp/htdocs">
.
.
Restart Apache and xampp and you should be up and running.

How to set mod_proxy to serve some files while others to be served by apache [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have enabled mod proxy to serve my jsp and servlets and it seem to work fine. So if i hit localhost, it takes request to tomcat and executes it. What is want is that servlets and jsp are forwarded to tomcat while php is handled by apache. Both JSP/Servlets and PHP files are in the same folder and I need to make a call from JSP?Servlet to PHP or may be vice versa as well. Now the problem is that PHP is also forwarded to tomcat it seems if I use following pattern -
ProxyPass /auto http://serv.corp.com:8080/auto/
All JSP/Servlets and PHP files are inside auto folder which is in webapps folder.
Kindly help me to route static content i.e. PHP to apache.
To server static content by Apache and remain files by appserver (jboss in my case)..
httpd.conf of Apache should look as:--
DocumentRoot /usr/local/apache2/htdocs
ProxyPass / !
ProxyPass / https://www.example.com:8443/
ProxyPassReverse / https://www.example.com:8443/
here for example /logo.gif will be served directly by
Apache from the /usr/local/apache2/htdocs/logo.gif file.
And everything else will be served by appserver.
Hope it will be useful
You want to use ProxyPassMatch rather than ProxyPass. Something like (untested)
ProxyPassMatch ^/(.*\.php)$ !

apache virtualhost SSL + non-SSL [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I'm having trouble figuring out what's the proper way to setup a SSL virtual host + a non-SSL copy of it.
I have it like this now:
<VirtualHost myip:80>
plenty of directives here
</VirtualHost>
and
<VirtualHost myip:443>
same directives as above
</VirtualHost>
And it works fine but every time I edit the directives in one of the vhosts, I must do it in the other as well. Anything cleaner and more elegant?
To run a website on both HTTP and HTTPS URLs, your only option is to run 2 separate VirtualHosts with the same DocumentRoot.
If the directives context allows, you can keep some of the common settings in a .htaccess file in a folder that is parent to both DocumentRoots.