Quantcast
Channel: WampServer - WampServer English
Viewing all articles
Browse latest Browse all 3177

How to use htaccess (1 reply)

$
0
0
I have done a lot of searching for htaccess information. Searched the web, saw a few youtube videos and read a few posts on Reddit.

To the basics. I have a local computer working as a development server. I use wampserver on a standard pc. I have setup a development domain for its use like dev.webdomain.com. Each web then get a subfolder name under the main domain. Like dev.webdomain.com/customer/

During time I have had strange errors and struggeled with htaccess file, but never took the time to understand it. Thats something I'm currently doing something with, but have not yet found all the answers.

My dev server is "silent" meaning I dont tell anyone except from those I do work for. Still, and I knew it would happen some time, I've been noticing unwanted visits and I want it to stop.

First of all I want to block out visits to the root directory dev.webdomain.com as it contains a list of projects and a way to edit and create projects and virtual hosts.

I have done this in htaccess(deny from all and allow from my ip's), but it also blocks out the customer sites I'm working on. I found that I could edit the htaccess file in each customer site to open them again to outsite access(allow from all).

Is there a way to make the htaccess file in my root folder only apply to that folder?

Is there a smarter way to do this?

I'm including my two versions of htaccess here:

Root htaccess:

# BEGIN WordPress

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /

RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]

</IfModule>



# END WordPress



AuthUserFile /dev/null

AuthGroupFile /dev/null

AuthName "WordPress Admin Access Control"

AuthType Basic

<LIMIT GET>

order deny,allow

deny from all

# whitelist tROND HJEMME IP address

#allow from xxx.xxx.xxx.xxx

# whitelist Kontorets IP address

allow from xxx.xxx.xxx.xxx

##whitelisted local ip's as I access the webserver by modifying my host file.

allow from 192.168.2.

allow from 192.168.1.

</LIMIT>

Opened customer project:

# BEGIN WordPress

# The directives (lines) between \BEGIN WordPress` and `END WordPress` are`

# dynamically generated, and should only be modified via WordPress filters.

# Any changes to the directives between these markers will be overwritten.

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /customer/

RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /customer/index.php [L]

</IfModule>



# END WordPress

allow from all

php_value upload_max_filesize 64M

php_value post_max_size 64M

php_value max_execution_time 300

php_value max_input_time 300

Viewing all articles
Browse latest Browse all 3177

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>