cannot locate .htaccess file in tomcat/apache configuration - apache

I have installed tomcat and apache on my ubuntu machine for development of a jsp-based website. I need to configure a url_rewrite and therefore need access to the .htaccess file. Can you please help me locate it?
Thanks,
Leonard

It doesn't have to exist already. You can make it yourself in the document root. Make sure AllowOverride All is set in your conf file :)

Related

How do I access .htaccess in Bitnami (Apache)?

I was wondering what the file path for my Bitnami Apache server for the .htaccess file.
I tried to find the answer online, but none of the answers I have looked at seem to be correct.
Bitnami Engineer here,
.htaccess files are disabled by default in the Bitnami solutions. You can modify the AllowOverride parameter in the Apache's configuration files inside the /opt/bitnami/apache2/conf and /opt/bitnami/apache2/conf/vhosts/ folders to enable them. However, we suggest you create a htaccess.conf file with the content of the .htaccess files and include in your app's conf file inside the /opt/bitnami/apache2/conf/vhosts/ folder. You can learn more about it here:
https://docs.bitnami.com/general/infrastructure/lamp/administration/use-htaccess/

My httpd.conf is empty

I recently installed apache2 on ubuntu but I have a problem, my httpd.conf is empty. Can someone give me a clean copy of httpd.conf for apache2 on ubuntu?
Thanks!
Edit: I saw your answers but on wampserver httpd.conf is not empty and as you mentioned it is for user options. SO what should I do?
Edit2 : That's what I got on my apache2.conf, how I add modules, enable gzip and all of that?
[Deleted the contents, as they render the question unreadable and are useless, because that were the default Apache2 configuration under Ubuntu.]
The /etc/apache2/httpd.conf is empty in Ubuntu, because the Apache configuration resides in /etc/apache2/apache2.conf!
“httpd.conf is for user options.” No it isn't, it's there for historic reasons.
Using Apache server, all user options should go into a new *.conf-file inside /etc/apache2/conf.d/. This method should be "update-safe", as httpd.conf or apache2.conf may get overwritten on the next server update.
Inside /etc/apache2/apache2.conf, you will find the following line, which includes those files:
# Include generic snippets of statements
Include conf.d/
As of Apache 2.4+ the user configuration directory is /etc/apache2/conf-available/. Use a2enconf FILENAME_WITHOUT_SUFFIX to enable the new configuration file or manually create a symlink in /etc/apache2/conf-enabled/. Be aware that as of Apache 2.4 the configuration files must have the suffix .conf (e.g. conf-available/my-settings.conf);
It's empty by default. You'll find a bunch of settings in /etc/apache2/apache2.conf.
In there it does this:
# Include all the user configurations:
Include httpd.conf
OK - what you're missing is that its designed to be more industrial and serve many sites, so the config you want is probably:
/etc/apache2/sites-available/default
which on my system is linked to from /etc/apache2/sites-enabled/
if you want to have different sites with different options, copy the file and then change those...
It seems to me, that it is by design that this file is empty.
A similar question has been asked here:
https://stackoverflow.com/questions/2567432/ubuntu-apache-httpd-conf-or-apache2-conf
So, you should have a look for /etc/apache2/apache2.conf

Multiple DocumentRoot in XAMPP or Apache

What would be the best way to set up XAMPP so that when I go to
http://localhost1 it access the folder C:\localhost1
and when I type
http://localhost2 it access the folder C:\localhost2?
I've done a response yesterday that should fit your needs:
Modify htaccess file for two sites
Use Alias in apache conf
http://www.apachefriends.org/f/viewtopic.php?f=16&t=36801
Make XAMPP/Apache serve file outside of htdocs

apache - how to override index of /icons?

I wasn't aware of this, and it is kind of funny; when you name a directory icons in the root of your host, then if you point your browser to host.com/icons, apache does not read from that directory and shows you a listing of Public Domain Icons.
I added an icons directory to the root and placed a key.png file in that directory, yet accessing that image results in 404. I tried to find if/where this has been documented and how it could be turned off. I found nothing. Could someone provide a pointer?
P.S. I am using XAMPP 1.7.3 which basically is a WAMP and has Apache 2.2.14
Edit
Aparently lots of live servers have this turned on and index of /icons could be seen lots of places.
Open this file: %XAMPP_PATH%\apache\conf\extra\httpd-autoindex.conf
and change :
Alias /icons/ "X:/xampp/apache/icons/"
<Directory "X:/xampp/apache/icons/">
to this:
Alias /icons/ "./icons/"
<Directory "./icons/">
Restart your Apache Server.
I'd assume that you have an alias within your httpd.conf.
I'm not familiar with XAMPP's config files or their location (google suggests it's probably in \xampp\apache\conf\httpd.conf) but I'd suggest you're looking for a line like the following:
Alias /icons/ /usr/local/apache/icons/
See http://httpd.apache.org/docs/current/mod/mod_alias.html for more info.
EDIT:
According to XMAPP site, you need to check \xampp\apache\conf\httpd.conf and the extra subfolder.
I would look in either your apache config file (\xampp\apache\conf\httpd.conf) or your .htaccess files and see if there is a redirect going on.
EDIT: I think Grhm is correct in that an Alias is in your config file somewhere, per the XAMPP site:
The main configuration file for Apache. It's including other files from the subdirectory "extra".
See if there is a directory called extra in the \xampp\apache\conf\ directory and then go through the files in there and see if that Alias is present.

the '.htaccess' file won't work on my apache server

I have an Apache server installed on my windows machine using XAMPP. Now I'm trying to use a premade .htaccess file for one of my projects, but it doesn't seem to be seeing it. The project just totally ignores it, even though I've enabled mod_rewrite.
Any idea how I can troubleshoot this? I can't fix it if it just doesn't work and doesn't show me any errors.
Appreciate your help.
In your httpd.conf file, you must enable .htaccess overriding with AllowOverride for the directory where the .htaccess file is (or parent thereof). If it is set to 'None', the .htaccess files will be ignored.