Questions tagged [rewritecond]
128 questions
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…
![](../../users/profiles/187591.webp)
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…
![](../../users/profiles/85055.webp)
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…
![](../../users/profiles/145786.webp)
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…
![](../../users/profiles/129360.webp)
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…
![](../../users/profiles/151662.webp)
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…
![](../../users/profiles/147769.webp)
jorijnsmit
- 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…
![](../../users/profiles/138849.webp)
Marc
- 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:
![](../../users/profiles/98597.webp)
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…
![](../../users/profiles/119060.webp)
MagicalArmchair
- 265
- 3
- 10
0
votes
1 answer
Multiple RewriteCond doesn't work
I have in htaccess some like this:
RewriteCond %{HTTP_HOST} !^foo
RewriteCond %{HTTP_HOST} !^bar
RewriteCond %{HTTP_HOST} !^some
RewriteRule ^register,(.*)$ /register.html [R=301,L]
RewriteRule ^offer,(.*)$ /offer.html [R=301,L]
It redirect me if I…
![](../../users/profiles/78385.webp)
Kamilos
- 225
- 1
- 3
- 9
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…
![](../../users/profiles/121205.webp)
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…
![](../../users/profiles/120985.webp)
jawns317
- 161
- 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…
![](../../users/profiles/36671.webp)
ServerChecker
- 1,498
- 2
- 14
- 32
0
votes
1 answer
mod_rewrite adds .html when redirecting
I have a redirect situation where the site is part dynamic and part generated .html files.
For example, mysite.com/homepage and mysite.com/products/42 are actually static html files
Whereas other URLs are dynamically generated, like…
0
votes
1 answer
Redirect URL including folder path
I have the following rewrite rule setup:
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://domain2.com/$1 [r=301,nc]
Now this works for redirecting domain.com/index.htm to domain2.com/index.htm however it won't redirect any…
![](../../users/profiles/59030.webp)
Luke
- 183
- 11