URL rewriting module for Apache web servers

learn more… | top users | synonyms (1)

4
votes
2answers
215 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
3answers
3k views

mod_rewrite REQUEST_FILENAME doesn't contain absolute path

I have a problem with a file test operation in a mod_rewrite RewriteCond entry which is testing whether %{REQUEST_FILENAME} exists. It seems that rather than %{REQUEST_FILENAME} being an absolute ...
4
votes
3answers
487 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
2k views

apache url / filename with special characters

I have this url: http://domain.com/wp-content/uploads/2012/10/Hvilke-vilkår-følger-med-når-du-bestiller-nyt-bredbånd.png If I ftp/ssh or just browse to that folder (apache index feature), I see ...
4
votes
2answers
2k 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
88 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
240 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
0answers
389 views

Mod_Rewrite w Apache mod_jrun22.so & ColdFusion 9 on cPanel [duplicate]

How can I utilize mod_rewrite at either the httpd.conf level or per-directory level when mod_jrun22 seems to have short-stopped the rewrite process for ColdFusion pages? I have a ColdFusion 9 ...
3
votes
3answers
207 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
4answers
1k views

Why do .htaccess redirects work in http but not with https?

I have a simple .htaccess file that works great on the http version of the site but not when I go to https. Why? RewriteEngine on #This is so if the file exists then use the file RewriteCond ...
3
votes
1answer
442 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
438 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
547 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
638 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
288 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
2k views

Redirecting SSL without raising an alert

A client has an SSL certificate only for the www.site.com version of the domain, not site.com. Redirecting for regular HTTP was not a problem via mod_rewrite. However, this method seemed to fail for ...
3
votes
2answers
2k 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
395 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
1answer
204 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
699 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
2k 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
3k 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
56 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
314 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
637 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
41 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
54 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
2answers
238 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
1answer
316 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
276 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
922 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
94 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
624 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
482 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
193 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 ...
3
votes
2answers
474 views

Using AddEncoding x-gzip .gz without actual files

With Apache (2.2 and later) how can I achieve the following. I want to transparently compress using GZip encoding (not plain Deflate) the output when a certain file is queried with its name plus the ...
3
votes
2answers
482 views

How can I use apache to redirect users (based on user_agent and using mod_rewrite) to my mobile site only if a mobile pages exists.

I want to detect mobile users based on their user_agent. If a user is browsing the full version of the site and they have a certain user_agent, I want to redirect them (using mod_rewrite) to the ...
3
votes
2answers
776 views

How to change mod_rewrite to avoid {REQUEST_FILENAME} in order to get around 255 character URL limit?

According to this answer: max length of url 257 characters for mod_rewrite? there is a maximum 255 character hard limit based on the file system for using mod_rewrite. According to the accepted ...
3
votes
1answer
2k views

Mod_Rewrite Apache ProxyPass?

I have two websites; OLDSITE and NEWSITE. The OLDSITE has 120 IP Address that it has with it, and the NEWSITE had 5. I want to be able to separate everything from OLDSITE and NEWSITE so they are not ...
3
votes
3answers
369 views

How can I make Apache look in 2 separate directories with one common url ? follow-up question

This is a follow-up question to my previous question on this site. Maybe I should point out that the Apache server is running on a windows system, don't know if it matters. My problem is following: ...
3
votes
1answer
42 views

Secure Apache when using mod_proxy_http and mod_rewrite

We have an Apache server that works as a proxy for apps running on different ports. For example: domain.com/app1/service1 > localhost:101 domain.com/app1/service2 > localhost:102 ...
3
votes
1answer
61 views

How to map path to path.html in Apache?

My old site was dynamic so all the permalinks were of this form: http://wangling.me/2000/01/file or `http://wangling.me/2000/01/file/ Now I just rebuilt my site with static html files so permalinks ...
3
votes
1answer
205 views

htaccess rewriting all subdomains to subdirectories

I'm trying to build a catch-all for any subdomains (not captured by previous rewrite rules) for a certain domain, and serve a website from a subdirectory that resides in the same folder as the ...
3
votes
1answer
1k 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
421 views

Apache nested virtual hosts

I have two virtual hosts in a apache server and I would like to do something but I don't know if is possible. The thing is that I have the main application developed and ruby and the blog is in ...
3
votes
2answers
485 views

Nginx rewrite with an external program

In Apache's mod_rewrite module there is a feature called RewriteMap. This allows an external program to be called to handle the redirects (allowing for more complicated redirecting). Is there an ...