Questions tagged [rewritecond]
132 questions
0
votes
1 answer
Apache rewrite using THE_REQUEST for rewriting GET requests only
Background:
In order to reduce repo size of git repos containing wordpress installs, we are removing static assets from the repo. The bulk of the work is done, but I have a snag. I've relocated the assets to an S3 bucket and used an .htaccess…

Nick Abbey
- 23
- 1
- 6
0
votes
2 answers
Rewrite only if Image don't exists with .htaccess
How do I make RewriteCond+RewriteRule change site1.com/folder1 to site2.com/folder1, only if file in this directory don't exist.
For example: site1.com/wp-content/uploads/2014/03/image.jpg
If image site1.com/wp-content/uploads/2014/03/image.jpg …

Orbital
- 115
- 1
- 5
0
votes
1 answer
htaccess rewrite condition old site to new site with querystring
I am not even going to pretend to fully understand how htaccess rewrite conditions work. I've been working on this for a while searching and searching.
I have an old Wordpress site www.old-site.com and a new site www.site.com. Wordpress uses query…

Brandon Braner
- 1
- 2
0
votes
1 answer
SSL/TLS Client certificate Authentication using RewriteCond and Rewrite Rules to perceptively redirect traffic not authorized
I finally end up to write here because I´m badly struggling against apache, SSL/TLS and a client certificate authentication that should use the certificate´s Serial Number to restrict access to a specific API call.
better to explain with some…

zimaldone
- 1
- 1
0
votes
1 answer
Apache 301 redirect in vhost
I wish to redirect(301) a url if the url dont have a string present in it.
eg:
http:://example.com must always redirected to http:://example.com/en
http:://example.com/test.html must always redirected to…

viMaL
- 103
- 3
0
votes
1 answer
RewriteRule (to remove .php) and old redirect 301 not working?
I'm not experienced in editing .htaccess
I wanted to
redirect non-www to www.
remove .php extension
set up a custom 404 page
I managed to do this (looking for solution in the web and on serverfault.com), but now it seems that my old redirect 301…

mattewre
- 31
- 4
0
votes
1 answer
Apache internal redirect limit reached
I have following problem:
Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
The apache tries to reach…

Jevgeni Smirnov
- 492
- 1
- 6
- 22
0
votes
1 answer
Redirecting all pages except for a select few back to HTTP
I'm using the rewrite rules below to redirect 2 php pages to https (to protect user data), but whenever I click on any links on those php pages they redirect with https enabled and the page does not display correctly.
The rules at the bottom were…

user1684850
- 11
- 2
0
votes
1 answer
existing file gives 404 due to a RewriteCond rule in .htaccess
To redirect a specific domain name to a folder in my public dir, www/, I edited .htaccess to the following:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.+)?domain.com$
RewriteRule ^(/)?$ domain.com/$1 [L]
Pointing my browser to http://domain.com…

gosuto
- 111
- 4
0
votes
2 answers
Apache mod_rewrite redirect with prefix
I am newbie with Apache's mod_rewrite and I'm having some difficulties getting it to do what I want.
In my static directory, I have some javascript files (.js) with 2 kind of filename:
xxxx.js which is the standard file name
AT_xxxx.js (with…

Marc
- 1
- 1
- 1
0
votes
1 answer
mod_rewrite to a folder except for a set of domains
Could anyone help to with the following issue:
I'm trying to do a rewrite on all domains that won't match and push them to a given folder. The following vhost works locally (Mac OS X with XAMPP), but is not working on a Debian server:

Ain
- 188
- 7
0
votes
2 answers
RewriteCond and the www record
In my httpd.ini I redirect all traffic from "example.co.uk" to "www.example.co.uk", the below works fine for this:
RewriteCond %HTTPS off
RewriteCond Host: (?!^www.example.co.uk)(.+)
RewriteRule /(.*) http\://www.example.co.uk/$2 [I,RP]
I have a…

MagicalArmchair
- 265
- 3
- 10
0
votes
1 answer
Apache Rewrite not rewriting as expected
I'm trying to use mod_rewrite to redirect users to the HTTPS equivalent URL unless the URL is for my Jenkins CI server. Here is the rule I have in my default site config (my Jenkins and other sites have their own respective VirtualHost…

John S
- 135
- 7
0
votes
1 answer
.htaccess: Backreference in RewriteCond to check for file existence?
I'm trying to match URLs of this type:
http://www.example.com/image/12345
I'd then like to check whether this file exists:
http://www.example.com/files/image_12345.jpg
If it does, I'd like to rewrite the URL to point to that file.
If it doesn't I'd…

jawns317
- 171
- 1
- 1
- 4
0
votes
3 answers
www vs. non-www and subdirs with special .htaccess
In my root folder, the following captures https://example.org and http://example.org and redirects to its respective version (http or https) with the www added back in. (It's a requirement they had with an advertisement system.)
The problem however…

ServerChecker
- 1,518
- 2
- 14
- 35