URL rewriting module for Apache web servers

learn more… | top users | synonyms (1)

4
votes
2answers
3k views

Apache mod_proxy vs mod_rewrite

What is the difference between using mod_proxy and mod_rewrite? I have a requirement to send certain url patterns through the tomcat, which runs on the same host but under port 8080. I know this is ...
4
votes
4answers
2k views

Preventing vulnerability scripts from scanning apache server

Quick question for you all - fairly frequently in my httpd logs I see things like this: 66.11.122.194 - - [29/Jan/2010:11:06:44 +0000] "GET HTTP/1.1 HTTP/1.1" 400 418 "-" "Toata dragostea mea pentru ...
4
votes
2answers
4k views

Precedence of RewriteRules in .htaccess file on Apache Server

I have a number of RewriteRules in my .htaccess file. However, one specific rule is only executed if I remove another specific rule, regardless of how I order the two rules. Here's the rule which ...
4
votes
4answers
6k views

.htaccess not working (mod_rewrite)

Edit: I am pretty sure my .htaccess file is NOT being executed, and the problem is NOT with my rewrite rules. I have not having any luck getting my .htaccess with mod_rewrite working. Basically all ...
4
votes
2answers
3k views

apache2 - how to exclude alias from rewrite rules?

I have setup mod_rewrite and mod_alias on Apache2 on Debian (in a test server). I have the following rewrite code in /etc/apache2/sites-available/default: <Directory /> Options ...
4
votes
1answer
2k views

How do I reset Apache's RewriteCond directive?

I have some Apache configuration like this: # Image hotlinking rule RewriteCond %{HTTP_REFERER} ^http://badsite\.com/ RewriteRule .*/static/artwork/.*\.(jpg|png)$ /static/images/hotlink.png [L] # ...
4
votes
1answer
2k views

Forcing SSL in Apache without hard-coding the hostname

I think that I have this sorted (thanks mainly to the question How to redirect non-www to www without hardcoding using .htaccess?), but I still don't entirely understand a couple of things. I would ...
4
votes
2answers
338 views

Why does a $1 backreference work in a rewrite with no subgroups?

Someone I'm working with committed a RewriteRule such as the following to SVN: RewriteRule ^admin/ebay.*$ /yii.php/$1 [L] I warned him that it may not work because there is no subgroup in the match ...
4
votes
2answers
5k views

In Apache does the .htaccess file override the httpd.conf for mod_rewrites?

In my Apache httpd.conf file I have this declaration inside a VirtualHost tag. RewriteEngine On RewriteCond %{HTTP_HOST} !^www.shanestillwell.com$ [NC] RewriteRule ^(.*)$ ...
4
votes
5answers
2k views

Apache mod_rewrite remove question mark (?) and query-string substitution

I registered a RewriteRule with mod_rewrite, but the substituted URL are wrong. The rule are: RewriteRule ^/img/z(0|1)u(.+)\.(gif|jpg|jpeg|png)$ /image-servlet/img/?z=$1&url=$2 ...
4
votes
1answer
5k views

how to rewrite '%25' in url

My website software replaces space characters with '+' characters in the URL, A proper link would look like 'http://www.schirmacher.de/display/INFO/How+to+reattach+a+disk+to+XenServer' for example. ...
4
votes
1answer
65 views

Methods for redirecting to a utility server

I have a situation where I need to facilitate file uploads of up to 200M to a utility server which is separate from the main web site server. Here's my configuration: Authenticated Client on Public ...
4
votes
1answer
514 views

Dynamic subdomains, mod_python and trac

I'm going to be running multiple subdomains, eventually too many to be able to each have their own config files. I have the vhosts working how I want them so each subdomain has their own folder eg ...
4
votes
1answer
3k views

htaccess redirect all to one file (except from localhost)

I want to redirect all traffic to a single .php gateway file, this file will do authentication and use ajax to pull the file that was requested. So I need a .htaccess with flow like this: if ...
4
votes
2answers
25k views

Apache URL rewriting in reverse proxy

I'm deploying Apache in front of a Karaf-hosted application (Apache and Karaf are on separate servers). I want Apache to operate as a reverse proxy and also to hide part of the URL. The URL to get ...
4
votes
2answers
2k views

How do I set up URL Rewriting to a Heroku instance?

I'm more of an engineer than a devops guy, so please excuse me if this is extremely basic. My situation: I have a server on the example.edu network, so I don't control the main DNS interface to ...
4
votes
2answers
306 views

Can mod_rewrite Conditions/Rules be executed in random order?

I have some mod rewrite rules that test for the presence of a file on various NFS mounts and I would like that the tests occur randomly, as a very rudimentary way to distribute load. For example: ...
4
votes
2answers
4k views

mod_cache not working

I have a PHP site that has many dynamically generated pages. I'm trying to turn to mod_cache to help boost performance, because in most cases, content does not change in a given day. I have ...
4
votes
2answers
116 views

Apache equivalent of IIS application roots

Someone just set up a directory for me on an Apache server where I will put my PHP application. This directory has an external path of 192.168.1.5/app and points to /home/test/app. My application ...
4
votes
1answer
254 views

How to redirect elgantly many redirects in htaccess?

Q1. is it possible to further optimize / compact the following rules, thereby making the entire redirections faster and easier to maintain in future? There are about twenty of these domains!! you get ...
4
votes
1answer
2k views

Apache Mod_rewrite rule working on one server, but not another

I am using mod_jk and mod_rewrite on httpd 2.2.15. I have a rule.... RewriteCond %{REQUEST_URI} !^/video/play\.xhtml.* RewriteRule ^/video/(.*) /video/play.xhtml?vid=$1 [PT] I just want to rewrite ...
3
votes
3answers
6k views

Url redirect to another page on the same site

Basically I want to redirect all requests to my domain to a specific page. For example, redirect all requests to page X, unless you are already on page X, in which case you should just load it. But my ...
3
votes
2answers
2k views

Is there a way to access 'mod_rewrite' before 'mod_ssl'?

Scenario: I have 2 domains: thinkingmonkey.me & thinkingmonkey.com. Whole of the site is accessed under https. Bought a certificate from a CA with common name thinkingmonkey.me. For http: ...
3
votes
3answers
4k views

Why is this mod_rewrite RewriteRule directive not working in the .htaccess file?

I've got a site that was hosted on a linux el cheapo hosting service that I'm migrating to my Mac OS X 10.5 Leopard Server server running Apache 2.2.8 & PHP 5.2.5 w/rewrite_module enabled and ...
3
votes
1answer
11k views

How to pass a request from one apache server to another

I have two Apache Servers with mod_proxy enabled. I want to know how to "pass the request" from "Apache Server A" to "Apache Server B" using the same port (80). In "server A" with internal ip: ...
3
votes
1answer
5k views

Masking the URL in a mod_rewrite

Is there any way of doing a mod_rewrite from one domain to another, but keeping the browser URL the same throughout? This is what I want: User enters something like bacon.com and ends up on ...
3
votes
1answer
613 views

Passing optional query variables through .htaccess

Oh, .htaccess hurts my head. So, I have a webpage which has a pretty URL of foo.com/radio/jobs though actually lives at foo.com/content/directory_jobs.php/?section=radio I achieve this using an ...
3
votes
2answers
736 views

Need to link WP Blog with Rails App on Heroku

I have a client who wants to migrate his Rails app to Heroku. However the client also has a blog associated with his domain that runs on WordPress. Currently, the WordPress blog is running happily ...
3
votes
2answers
2k views

mod_rewrite remove trailing slash is causing loops

I have a site using mod_rewrite to make pretty URLs ... everywhere I read the removing the trailing slash is good for SEO and therefore I went with the rule: RewriteRule ^(.+)/$ /$1 [R=301,L] I ...
3
votes
1answer
363 views

Is it possible to rewrite some query strings to HTTPS and keep everything else on HTTP?

I'm rewriting query strings to pretty URIs, example: index.php?q=/en/contact becomes /en/contact and all works nicely.. # httpd.conf # HANDLE THE QUERY RewriteCond %{REQUEST_FILENAME} !-f ...
3
votes
2answers
9k views

Apache rewrite multiple conditions

I have a website that's migrated from an old domain name (e.g. olddomain.com) to a new domain name (e.g. newdomain.com). For SEO reasons, I need to rewrite all website traffic to the primary new ...
3
votes
2answers
5k views

Rewrite HOST without redirecting to the rewritten hostname, is that possible?

I only have one virtual host available with my service provider the folder structure is similar to this: domains primarydomain.ext stat www secondary (<- this is the folder for ...
3
votes
2answers
719 views

Is it possible for the Subversion Apache module to serve html files with an html content-type without using the svn:mime-type property?

I am aware that if you set the svn:mime-type Subversion property on a .html file to text/html then when viewing the file in a browser through the Subversion module in Apache httpd it will be served ...
3
votes
3answers
1k views

Configuring htaccess/mod_rewrite to serve static files with question mark in the URL

I've just taken on hosting of an ancient site that was converted from asp to static html, consisting of about 6,000 files. However, my server doesn't like the filenames, giving a 404 error. The URLs ...
3
votes
2answers
4k views

RewriteRules not stopping with LAST flag?

I seem to be having trouble with Apache 2.2's Rewrite module (running on FreeBSD 8). My .htaccess file is as follows: Options -Indexes RewriteEngine on RewriteRule ^xpaste$ cross.php [L] ...
3
votes
2answers
3k views

Apache mod_rewrite not working properly on Mac OS X 10.6 (Snow Leopard)

I'm trying to create a PHP website with clean URLs with Apache's mod_rewrite, using a .htaccess file. mod_rewrite seems to be working, however, it claims it cannot find files on my server that do ...
3
votes
2answers
742 views

mod-rewrite: Replacing some characters in a url

Is it possible to replace some forward slashes (/) of a URL to dots (.) in a RewriteRule? It doesn't have to be done exclusively with a RewriteRule, but definitely not with a script. Example 1: ...
3
votes
2answers
4k views

Regex negative look-ahead is not working for mod_rewrite between different Apache versions

I have a mod_rewrite line that works under Apache 2.2, but not under Apache 1.3: RewriteRule ^(?!index.php)(?!skin/)(?!js/)(.+) /index.php?file=$1 [NC,L] If I lose the ...
3
votes
3answers
3k views

Apache: How can I serve JavaScript via PHP?

I want to serve my JavaScript files via a PHP script. An example would be: If I were to request a JavaScript file called dir/my_file.js The server should redirect the request to a handler script ...
3
votes
3answers
587 views

Block traffic behind AWS ELB

My web servers are behind ELB, I want to block traffic from some specific user agent which is a DDOS attack. Apache always see ip address of ELB as an end user so I tried below attempts: Blocking IP ...
3
votes
1answer
232 views

htaccess mod_rewrite conundrum

Ok, so I have this .htaccess file that contains this <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} ...
3
votes
1answer
415 views

is it possible to display contents of an external URL through my website?

I have a domain, mydomain.com, which I would like to display content from another site. For example, imagine that there is content at this url --> http://www.foo.com/my/file.bar, and I would like the ...
3
votes
2answers
8k views

Alias a Virtual Directory or Application as Root on IIS 7

Our current IIS setup as two applications running on different paths at (for example) http://server/sub-a and http://server/sub-b. I want to alias http://server/sub-a as root so that just going to ...
3
votes
3answers
12k views

404 Error on a file that exists?

A script makes a GET request to my URL like so: http://mydomain.com/cgi-bin/uu_ini_status_audios.pl?tmp_sid=b742be1d131c4d32237a9f1fcdca659e&rnd_id=0.2363453360320319 However, I get a 404 ...
3
votes
2answers
4k views

How can I configure Apache to redirect a subdirectory to a subversion repo?

I have an old subversion repository that was set up as the only repo on a machine. We accessed the URLs like this: http://myserver.com/svn/trunk/... http://myserver.com/svn/branches/... We're ...
3
votes
3answers
2k views

Jboss + mod_rewrite =?

I have 2 servers, Apache and Jboss. Using JKmount .war files are mounted and present a complex site. eg: JkMount /directory/* ajp13 Alias /directory /jboss/server/default/deploy/directory.war ...
3
votes
2answers
3k views

Apache 2 mod_rewrite - How to read POST parameters?

I would like to use mod_rewrite to read parameters sent in POST requests. I need to check the value and process the request. thanks, Julien
3
votes
1answer
87 views

Apache Directives Ordering: Global, Pre-VHost, or in Directory blocks

I'm setting up my first virtual server from scratch (provider name omitted but it's a 'droplet'). I've been using WHM for a while and I feel I'm fairly familiar with it. Specifically, it's a Debian 8 ...
3
votes
1answer
67 views

Multiple rule Apache rewrite

I am trying to set up a hierarchy five levels deep with mod_rewrite. This is what I have put together at this point. It works for the last two levels (the first and second rule) but not after that. ...
3
votes
2answers
998 views

Apache configuration - rewrite rule for all virtual hosts

I have the following configuration with 2 virtual hosts on my Apache: www.domain.com and res.domain.com. The first one is open the second is limited to registred users. <VirtualHost *:80> ...