3

I've been developing my website using a local WAMP server, on my own laptop.

I just recently purchased a domain, and deployed my website there.

So far, everything works fine, except : the "Public_Html" folder on the Host-Server did not have a few files, which I thought should be there by default.

(1) .htaccess (2) php.ini (3) httpd.conf

The first two are no problem. I can simply create new ones myself (or, copy-paste the ones I currently use on my WAMP server)

However, the HTTPD.CONF file is a mystery to me.

Firstly, I have no idea where it is located. The domain-hosting service I am using is linux-based (not that it matters, I guess)

Secondly, I could, of course, simply copy the httpd.conf file I have now on my WAMP server. But, where would I copy it to ? I already copied it straight to the Public_Html folder, but that solved nothing.

My reason for needing this HTTPD.CONF is because, amongst other things, I need to modify many settings, the most important being : MOD_REWRITE. I need to enable mod_rewrite, so that I can properly configure the .HTACCESS file.

I searched online, and found many references to this httpd.conf, but nothing remotely resembling my situation

I contacted the so-called Customer Support service on my Domain Registrar. They said (and I quote) : if you want to make modifications to your domain configuration, create a file, write the configuration code there, and save the file as : .USER.INI and then save this file in the Public_Html folder".

Well, this solution did not sound right to me. But, I did it anyway. I copy-pasted the contents of my own httpd.conf file into this new .user.ini file, and saved it to the public_html folder.

Result: still nothing.

Jonas Libbrecht
  • 768
  • 1
  • 8
  • 17
phpnewbie2015
  • 366
  • 2
  • 4
  • 17
  • 2
    mod_rewrite is more than likely already turned on by default. If you got a shared hosting plan you won't have control over httpd.conf as it is shared between many people hosted on the same machine. – Ryan Lombardo May 08 '15 at 08:25
  • Thanks, Ryan. But, I have a couple of questions : (a) if my hosting plan is indeed shared, this means I don't need the HTTPD.CONF, because it's useless to try to change it, right? (b) if mod_rewrite is "enabled" by default, then : why is my .htaccess file not working? I wrote codes to remove file extensions (both HTML and PHP), but it's not working. – phpnewbie2015 May 08 '15 at 08:33
  • Any thoughts/tips would be greatly appreciated. Thanks again – phpnewbie2015 May 08 '15 at 08:34
  • (a) You are correct. There would be no reason to have a httpd.conf (b) The reason .htaccess may not be working may be because the server that is hosting your website is not running Apache. Instead it may be running IIS. In this case you will have to make a Web.config file instead of .htaccess file that performs the same url rewriting. Check with your website host to see what Operating System it is hosted on. Linux will generally be Apache and Windows would be IIS. – Ryan Lombardo May 08 '15 at 08:41
  • keep in mind that when you create files in linux with `.` like `.htaccess`, they are hidden... – Jonas Libbrecht May 08 '15 at 08:43
  • 1
    Thank you again Ryan. Actually, as I mentioned in my post, my domain is hosted on Linux. So I assume it's using Apache? – phpnewbie2015 May 08 '15 at 08:44
  • If you want to know more about `HTTPD` and its config: `HTTPD` is `apache` like and hosts a webserver with modules (like `PHP`, `HTML`, ...). In general it's a config to manage all the (added) modules of your webserver. (like if you want error display `on` of `PHP`, this can be found in `HTTPD` config) – Jonas Libbrecht May 08 '15 at 08:49
  • Thanks for your helpful response, Jonas. I know about HTTPD. As I mentioned in my post, I already have one on my local WAMP server. My problem was how to get one across to my newly-acquired public domain. My domain is on a shared service, so I dont need any HTTPD, as Ryan mentioned. That just leaves the issue of why my HTACCESS is not working as it should. – phpnewbie2015 May 08 '15 at 08:59
  • Looks like I should have paid more attention to the details of your original post! :P. At this point I'd refer to your hosting provider for details on how to achieve URL rewriting. Quite possibly they may have an option in their management console. – Ryan Lombardo May 08 '15 at 09:17
  • 1
    Thanks again, Ryan. Yeah, I guess that's my only option :) Although, considering the response they gave me regarding the HTTPD configuration, I have serious doubts about their competence. They could have simply told me not to bother with HTTPD, seeing as I am on a shared hosting service. Makes me wonder................. – phpnewbie2015 May 08 '15 at 09:21

1 Answers1

0

.htaccess
* Maybe the .htaccess is in the wrong location (determined by httpd.conf)
* Maybe the .htaccess has the wrong name (determined by httpd.conf)
* Maybe the .htaccess includes directives which are not allowed (determined by httpd.conf)
* http://httpd.apache.org/docs/current/howto/htaccess.html

php.ini
* Just as with httpd.conf there is almost certainly a "global" copy in which case you may only be able to "override" particular settings
* Chopy/paste from another copy elsewhere as a starting point or simply build one with what you need
* http://php.net/manual/en/ini.php
* To find the location of php.ini and its configuration create a test.php as follows...

<?php phpinfo(); ?>

...then point your browser at it.

httpd.conf
* Your provided has a global copy in place which you almost certainly do not have access to and will have some controls in place to limit user-configured directives in their own .conf - you'll have to contact your provider for specifics
* Try accessing /server-info and /server-status (though they are not enabled by default so don't be surprised if you get 404s) - this will give some insight into the configuration
* httpd.conf should not reside in publicly accessible folders
* http://httpd.apache.org/docs/current/

You will be best suited by directing your questions to your provider.

Hopefully this helps.

user1801810
  • 614
  • 1
  • 11
  • 29