Sponsored Content
Top Forums Web Development Negate user space URL in Apache Post 302476656 by LostInTheWoods on Thursday 2nd of December 2010 07:40:53 AM
Old 12-02-2010
Negate user space URL in Apache

Hello,

I have a situation where I am trying to use Apache's RedirectMatch directive to redirect all users to a HTTPS URL except a single (Linux) user accessing there own webspace. I have found a piece of regular expression code that negates the username:

Code:
 ^((?!andy).)*$

but when I try using it in the directive:

Code:
RedirectMatch ^((?!andy).)*$ https://www.example.com/

the URL:

Code:
http://www.example.com/~andy/

still gets redirected to the HTTPS URL:

Code:
https://www.example.com/

Also if I comment out the line:

Code:
# RedirectMatch ^((?!andy).)*$ https://www.example.com/

and restart Apache, and then try the URL:

Code:
http://www.example.com/andy

I get a 404 response, which is expected. But, if I try the URL:

Code:
http://www.example.com/~andy

The redirect is triggered and I am redirected to:

Code:
https://www.example.com/

and as I said, the redirect is commented out and I have restarted the server. How can this happen? So this is not just a regex thing, it seems Apache is redirecting without instruction!

I am not an expert in regular expressions (or Apache), so any help in getting this working would be greatly appreciated.

Thanks,
Stephen
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Apache, hiding the url

Hello, how to hide the full addres url, in apache web server. eg, www.example.org/www/pub/index.html, the address in browser only www.example.org . Thank You. (2 Replies)
Discussion started by: blesets
2 Replies

2. UNIX for Advanced & Expert Users

apache encode special characters in URL

Hi all, How can I enable encoding of special characters present in URL? eg If the URL is http://127.0.0.1/test.cgi?param1=test & test co it shouldbe encoded to http://127.0.0.1/test.cgi?param1=test%20%26%20test%20co Thanks and Reagards, uttam hoode (3 Replies)
Discussion started by: uttamhoode
3 Replies

3. Cybersecurity

APACHE rewrite / redirect URL

Hello. I have scenario where a Client send request to Server1. Server1 send request to Server2. Request are xmlHTTPRequest - need to get data (XML) from Server2 back to client. Trying to use APACHE proxy... Anyone can help? What to download / configure / ...? Thank you for your help. (1 Reply)
Discussion started by: ampo
1 Replies

4. Web Development

APACHE rewrite / redirect URL

Hello. I have scenario where a Client send request to Server1. Server1 send request to Server2. Request are xmlHTTPRequest - need to get data (XML) from Server2 back to client. Trying to use APACHE proxy... Anyone can help? What to download / configure / ...? Thank you for your... (2 Replies)
Discussion started by: ampo
2 Replies

5. Shell Programming and Scripting

redirecting a url on apache conf file

i need help on redirecting apache conf file i want redirect everything to www.example.com/home example if i type a url www.example.com/home/text1 i need that redirected to www.example.com/home (0 Replies)
Discussion started by: shehzad_m
0 Replies

6. Web Development

Apache Virtual URL

Hi All, i'am facing a problem with urls that don't have a filestructure under DocumentRoot. A URL like http://mydomain.com/applicationrew/Structure1/Structure2/some?parameter=key&parameter1=key1 Should be rewritet to something else. Now i defined a Location like <Location ~... (3 Replies)
Discussion started by: wuschelz
3 Replies

7. UNIX for Advanced & Expert Users

apache webserver url redirection

I need help in apache url redirection: I have added the below command in httpd.conf and it is working fine. Redirect http://xyz.com/site/homehttp://abc.com/site/home Can we set a rule such that http://xyz.com/site/* -> http://abc.com/site/* is applied For... (0 Replies)
Discussion started by: raghur77
0 Replies

8. Web Development

apache url redirection

I need help in apache url redirection: I have added the below command in httpd.conf and it is working fine. Redirect http://xyz.com/site/homehttp://abc.com/site/home Can we set a rule such that http://xyz.com/site/* -> http://abc.com/site/* is applied For... (0 Replies)
Discussion started by: raghur77
0 Replies

9. Web Development

Append query string via URL rewrite in apache

Hi, Googled around but I couldn't find anything similar. I'm looking to do the following in apache.. if a user comes into the following URL. http://www.example.com/some/thing.cid?wholebunch_of_stuff_here keep the URL exactly as is BUT add &something at the very end of it. thanks in... (1 Reply)
Discussion started by: kmaq7621
1 Replies

10. Red Hat

How to block some key words in my url for apache config?

Hi Folks, I am running a website and that needs to be tightened with security in terms of hacking... Whereas, In my URL, when i click on certain links the entire link as contains some words like below:/control_panel /controlpanel /admin /cms Whereas, i need to block those words in apache... (1 Reply)
Discussion started by: gsiva
1 Replies
Apache::XMLRPC(3pm)					User Contributed Perl Documentation				       Apache::XMLRPC(3pm)

NAME
Apache::XMLRPC - serve XML-RPC requests from Apache SYNOPSIS
## ## Directives for your Apache config file. ## <Location /RPC2> SetHandler perl-script PerlHandler Apache::XMLRPC PerlSetVar XMLRPC_Config /usr/local/apache/xml-rpc/services </Location> ## ## In the 'services' file referenced above by 'XMLRPC_Config' ## sub foo { ... } sub bar { ... } $map = { foo => &foo, bar => &bar, }; 1; DESCRIPTION
Apache::XMLRPC serves Userland XML-RPC requests from Apache/mod_perl using the Frontier::RPC2 module. Configuring Apache::XMLRPC to work under mod_perl is a two step process. First, you must declare a "<Location>" directive in your Apache configuration file which tells Apache to use the content handler found in the Apache::XMLRPC module and defines a variable which tells the module where to find your services. Then, you must define the services. Apache Configuration Apache configuration is as simple as the "<Location>" directive shown in the synopsis above. Any directive allowed by Apache inside a "<Location>" block is allowed here, but the three lines shown above are required. Pay close attention to the 'PerlSetVar XMLRPC_Config ...' line as this is where you tell Apache where to find your services. This file may reside anywhere accessible by Apache. Defining Services To actually define the XML-RPC routines that will be served, they must reside in the file referenced by the 'PerlSetVar XMLRPC_Config ...' directive in the Apache configuration file. In this file you may place as many Perl subroutines as you like, but only those which are explicitly published will be available to your XML-RPC clients. To publish a subroutine, it must be included in the hash reference named $map (the hash reference must have this name as this is the variable that the Apache::XMLRPC passes to Frontier::RPC2::serve to actually service each request) The hash reference must be defined in this "services" file. The keys of the hash are the service names visible to the XML-RPC clients while the hash values are references to the subroutines you wish to make public. There is no requirement that the published service names match those of their associated subroutines, but it does make administration a little easier. SEE ALSO
perl(1), Frontier::RPC2(3) <http://www.scripting.com/frontier5/xml/code/rpc.html> AUTHOR
Ed Hill <ed-hill@uiowa.edu> is the original author. Tim Peoples <tep@colltech.com> added a few tweaks and all the documenation. perl v5.10.1 2011-04-05 Apache::XMLRPC(3pm)
All times are GMT -4. The time now is 10:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy