apache2

How to get .htaccess files working with Apache VirtualHost

痞子三分冷 提交于 2019-12-22 03:43:32
问题 My problem is that my .htaccess file on my local server is not being read. The settings in the VirtualHost file seem to always take precedence. I have tried the following: Enabled mod_rewrite Changed the AllowOverride to All but this causes a HTTP Error 500 Internal server error . I have tried it with various options but it always causes a 500 error. I am using a VirtualHost file on Ubuntu which looks like the following: <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /web

Apache2 - authorize users against a Location using BasicAuth but ONLY for users outside local subnet

故事扮演 提交于 2019-12-22 01:36:36
问题 In my Apache 2 config I have a VirtualHost which looks something like this: <VirtualHost *:80> ServerName sub.domain.com # username:password sent on to endpoint RequestHeader set Authorization "Basic dXNlcm5hbWU6cGFzc3dvcmQ==" ProxyPass /xyz http://192.168.1.253:8080/endpoint ProxyPassReverse /xyz http://192.168.1.253:8080/endpoint <Location /xyz> # This needs to let users through under the following circumstances # * They are in 192.168.1.0/24 # * They have a valid user in a htpasswd file #

Apache (xamp) and IIS cannot work together

て烟熏妆下的殇ゞ 提交于 2019-12-22 00:27:43
问题 I have XAMP 1.6.8 and IIS 5.0 installed on my PC(Windows XP SP3). I'm unable to run them simultaneously. If IIS service is running, Apache throws the following error: (OS 10048)Only one usage of each socket address (protocol/network address/port) is normally permitted. : make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down Unable to open logs Note the errors or messages above, and press the key to exit. 24... Windows could not start the Apache2 on

Why does htaccess RewriteRule ^foo$ also match ^foobar$

纵然是瞬间 提交于 2019-12-21 23:32:47
问题 I want these URL redirects / forwards: here.com/foo ==> there.com/a/b here.com/foobar ==> there.com/c/d I have these two .htaccess RewriteRule lines: RewriteRule ^foo$ http://there.com/a/b [R=301,L] RewriteRule ^foobar$ http://there.com/c/d [R=301,L] But the result is: here.com/foo ==> there.com/a/b here.com/foobar ==> there.com/a/b foo is also matching foobar How do I make it work? 回答1: This was a browser caching issue. I initially had the rules wrong. I changed the rules to those listed

Replace image and javascript absolute paths through proxy_redirect in nginx

≯℡__Kan透↙ 提交于 2019-12-21 23:26:29
问题 I have a scenario as follows. Nginx is being used as a reverse proxy to a apache server listening at port 8080. nginx is running at port 80. There is a wsgi application which is being run by the apache server. Now, I have added a proxy_pass to the nginx configuration such that whatever requests come to localhost/ (nginx port is the default port 80) they get redirected to localhost:8080. Here is an excerpt from the nginx conf file: server { listen 80; proxy_set_header X-Real-IP $remote_addr;

Displaying custom error page in PHP for errors which can't be caught by set_error_handler

谁说胖子不能爱 提交于 2019-12-21 22:06:44
问题 I would like to be able to discard a partially rendered page and show an error page in PHP. I already know about set_error_handler() , but it can only trap certain types of errors . I would like to know how to show an error page when an error type which can't be trapped by set_error_handler() is raised. Unfortunately, it seems that the following code, when run with PHP 5.3.2 on Apache 2.2, doesn't do what I would expect it to do: <?php // Start the output buffer ob_start(); // Output

Apache 2.4 — how to close entire site except one subdirectory?

耗尽温柔 提交于 2019-12-21 21:44:08
问题 We are using the new authentication and authorization framework offered by Apache-2.4 and need to close the entire site (Location /) to unauthorized access except for one subdirectory (Location /foo), where there authorizing cookie can be obtained. It would seem, that AuthMerging is the directive to use, but things do not work: <Location /> AuthType form AuthFormProvider foo Session On SessionCookieName ti2f Include conf/sessionpw.conf AuthName TI <RequireAll> Require foo ipaddress Require

Mapping a secondary domain to a subdirectory using mod_rewrite

主宰稳场 提交于 2019-12-21 20:49:40
问题 I am looking to map a secondary domain to a subfolder on my document root. For example, if requests to the domain www.example.com map to my DocumentToot, then requests to www.exampletwo.com go to /sites/files/ . I am unable to accomplish a redirect from www.exampletwo.com/index.html to www.exampletwo.com/sites/files/index.html while making the URL still display www.exampletwo.com/index.html . Any ideas? 回答1: I believe you're looking for something like this: RewriteCond %{HTTP_HOST} ^(www\.)

Best way to make www.example.com AND example.com use the same session variables?

為{幸葍}努か 提交于 2019-12-21 17:46:19
问题 I'm working on a webpage (let's call it example.com) and added the DNS record under CNAME (Alias): Host Record Points to TTL www example.com 14400 However when I navigate through example.com, the session variables that are set are not retained if I go to www.example.com What is the best way to make www.example.com AND example.com use the same session variables? I'm using ubuntu 12.04, php5, apache2. <VirtualHost *:80> ServerAdmin webmaster@localhost ServerName www.example.com Redirect 301 /

Why can't I disable .htaccess in Apache?

浪尽此生 提交于 2019-12-21 17:16:32
问题 This is the opposite problem from most about which I have read. I am running Ubuntu 8.04 on an Amazon instance with Apache 2.2.8 and I can't figure out why setting AllowOverride to None for root doesn't stop my .htaccess file from being included. I have a sub-directory with hello.py in it and an .htaccess file. When I browse to the file, it works fine with modpython serving the file. If I put some garbage in .htaccess I get a server error, so I know the .htaccess file is being used. Also if I