URL rewriting module for Apache web servers

learn more… | top users | synonyms (1)

4
votes
1answer
484 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
3answers
1k views

How do I create a custom header from an existing SSL environment variable?

OK I have spent all day on this-- I'm using apache with mod_ssl I'm trying to take an existing environment header, "%{SSL_CLIENT_S_DN_CN}s" which looks like "Lastname Firstname Mi username" and set a ...
4
votes
2answers
1k 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
254 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
3k 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
100 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
250 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
1k 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 ...
4
votes
1answer
2k views

Apache sends plain-text response when accessing SSL-enabled site without HTTPS

I've never encountered something such as this before. I was attempting to simply redirect the page to the HTTPS version if it determined that HTTPS was off, but instead it's displaying an HTML page ...
3
votes
2answers
1k 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
2answers
2k views

Is there a limit for .htaccess?

Hey all. I was just wondering if there's a limit for the .htaccess file for Apache 2. I'm working on a caching plugin and thaught that it might be a good idea to use the .htaccess file to point to ...
3
votes
3answers
250 views

The 301 'www' nightmare. How do I change back?

About six months ago, I decided it would be best to put my website on the naked domain, let's just say 'example.com'. I did what all the instructions websites have told me with adding a 301 redirect ...
3
votes
1answer
780 views

When does Apache re-read the updates to .htaccess files?

I have a hosted server. When I update .htaccess, are the updated rules immediately in effect? I understand that hosters can do what they want, and it's impossible to know without knowing the ...
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
508 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
650 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
1answer
2k 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
2answers
1k 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
332 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
1answer
1k views

Understanding apache 2.4 mod_proxy_fcgi and RewriteRules in htaccess

We've recently switched one of our web servers to apache 2.4 and running PHP via php-fpm and mod_proxy_fcgi. Most everything works quite well, but there is one problem that I don't understand yet. One ...
3
votes
2answers
4k 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
3answers
974 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
3k 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
2k 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
539 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
3answers
194 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
457 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
1answer
223 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
2answers
3k 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 ^(.*)$ ...
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
2k 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
58 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
624 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> ...
3
votes
1answer
982 views

How to redirect all non www and http traffic to www and https with Apache2

In my httpd.conf, I have RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^mysite.com [NC] RewriteRule ^(.*)$ https://www.mysite.com/$1 [L,R=301] But that's not working properly. I want the ...
3
votes
2answers
43 views

Apache ModRewrite fail on one directory

Apache Rewrite Problem i'm moving parts of my site at 〔xahlee.org〕 to 〔wordyenglish.com〕. I have this in 〔.htaccess〕: … RewriteRule ^PageTwo_dir/Vocabulary_dir/(.*)$ http://wordyenglish.com/words/$1 ...
3
votes
1answer
55 views

Redirect /pagename to /#pagename

I would like to get the following apache-redirect working: When someone surfs to mydomain.tld/contact, they should be redirected to mydomain.tld/#contact. This is because I built a one-page-website ...
3
votes
1answer
1k views

Apache mod_rewrite weird behavior in Internet Explorer

I'm attempting to setup redirection for a couple of root domains. Firstly, here is the code in my httpd-vhosts.conf file: <VirtualHost *:80> ServerAdmin ****@example.com ServerName ...
3
votes
2answers
255 views

Is there an Elegant solution to rewrite long image?query-urls into cachable_nice_urls, using only apache htaccess?

this is a pain in the ass-problem! Whicever genius solves this riddle will receive paypal donation to eat diner for two. Now lets get started. Given: most proxies, do not cache resources with a "?" in ...
3
votes
3answers
8k 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
1answer
333 views

Prevent Flash file hotlinking from Amazon S3

How does one prevent hotlinking of swf files from an Amazon S3 file system? Flash files don't send http referrers, so I've tried to set a bucket policy that restricts to certain referrers at Amazon, ...
3
votes
6answers
283 views

htaccess noob needs your opinion and elite skills :)

brand new with .htaccess and I have read the howto's for weeks along with a load of experimenting. I desperately need someone to look at the thing for me and tell me if anything is wrong or just plain ...
3
votes
3answers
1k views

Need help finding what is wrong with my .htaccess not being read

I'm trying to use mod_rewrite through the .htaccess files and I have a big problem, the .htaccess files don't seems to be read. The machine is running Debian 5.0 and it's using the stable apache2 ...
3
votes
5answers
4k views

Apache Redirect folder to subdomain

A client had an application at www.domain.com/dir. They have now set up a subdomain at dir.domain.com. The subdomain references the files stored at www.domain.com/dir. They'd now like people accessing ...
3
votes
2answers
590 views

Mass virtual hosting with Apache 2.4

I would like to use the value set by VirtualDocumentRoot in a RewriteRule. The Apache documentation says: The other thing to determine is the document root (configured with DocumentRoot and ...
3
votes
2answers
11k 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 ...
3
votes
2answers
868 views

Apache reports a 200 status for non-existent WordPress URLs

The WordPress .htaccess generally has the following rewrite rules: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond ...
3
votes
1answer
674 views

Redirecting paths to shebang through .htaccess?

I had a small bit of code that would redirect pages accessed from my own domain to their hash addresses, like so: example.com/stationary.html => example.com/#/stationary This was the code: ...
3
votes
1answer
261 views

Does a RewriteCond that checks for the existence of a file cause high IO latency?

I am setting up an apache configuration to check for the existence of a file. If the file exists, then the server will redirect to a maintenance page. If not, the application will get served up ...