The rewritecond tag has no wiki summary.
0
votes
1answer
24 views
Apache rewrite rule infinite loop for subpage [duplicate]
I am trying to redirect toast.allthesmarts.com to toast.allthesmarts.com/dayone
RewriteEngine on
RewriteCond %{HTTP_HOST} toast.allthesmarts.com
RewriteRule ^(.*)$ ...
0
votes
2answers
49 views
How do I make RewriteCond %{HTTP_COOKIE} match a cookie value exactly?
How do I make my rule match an exact value of a cookie? I've tried:
RewriteCond %{HTTP_COOKIE} ^its=me$ [NC]
RewriteCond %{HTTP_COOKIE} its=^me$ [NC]
RewriteCond %{HTTP_COOKIE} its="me" [NC]
...
0
votes
1answer
34 views
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 ...
0
votes
1answer
72 views
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 ...
0
votes
1answer
47 views
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 ...
1
vote
2answers
74 views
Redirect to a URL via htaccess if index.(html|php) doesn't exist
Is it possible to redirect (via a Rewrite Cond?) users to another URL for help if an index.html or index.php file doesn't exist within their home directory?
Thanks
Greg
1
vote
1answer
101 views
phpMyAdmin rewrite for nginx
I am trying to configure Nginx so that I can access PhpMyAdmin from a subdirectory (aka domain.com/phpmyadmin). The code provided below seems to work for me although I don't want the alias to be ...
0
votes
1answer
55 views
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 ...
0
votes
1answer
62 views
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 ^(/)?$ ...
1
vote
1answer
112 views
Prevent redirect loop in mod_rewrite
I'm writing a rule in my htaccess that basically says this:
If the request is for the homepage
And a cookie has not been set
Rewrite the page with /addCookie.php
Then in addCookie.php, we set the ...
1
vote
1answer
43 views
RewriteCond for multiple files
In htaccess file, RewriteCond for one file bla.php can write so right?
RewriteCond %{REQUEST_FILENAME} !bla.php
Question: how can write RewriteCond for multiple files? for example for 3 files: ...
0
votes
0answers
26 views
apache RewriteCond - how to log only the matches
I have a working RewriteCond and RewriteRule in apache on a busy server. I don't want to duplicate what's already in the apache logs. I only want to log the matches to the conditions. I've tried ...
0
votes
2answers
163 views
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 ...
0
votes
1answer
54 views
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 ...
3
votes
1answer
149 views
Trouble with www. redirect (.htaccess)
I'm trying to get a simple www. to non www. redirect set up. Here's the .htaccess
DirectoryIndex index.php
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.domain.org [NC]
RewriteRule ^(.*)$ ...
1
vote
1answer
86 views
Apache2 - Forward a value from URL param OR cookie, whichever is present
I managed to use apache to strip off a url param and stuff it in a header to be passed on to another server. See this question for reference.
Now I would like to add to this by getting the value for ...
0
votes
0answers
123 views
Apache2 RewriteRules and Conditions
I'm stuck in some apache rewrite rules I inherited from some other company and it's now my task to fix somebodies others mistake.
I have 2 sites defined this is the content:
<VirtualHost *:80>
...
0
votes
2answers
84 views
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 ...
0
votes
1answer
372 views
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 ...
0
votes
1answer
156 views
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 ...
0
votes
1answer
326 views
.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 ...
0
votes
3answers
233 views
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 ...
0
votes
1answer
59 views
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 ...
4
votes
1answer
650 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]
# ...
2
votes
1answer
127 views
apache httpd keep sending http requests to strange IPs
Recently I noticed my server keeps sending data to strange location "121.11.76.48" by netstat -na .
To find out what it is sending , I tried :
tcpdump -i eth0 host 121.11.76.48 -nnvvXSs 1514
And ...
0
votes
1answer
67 views
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 ...
1
vote
2answers
75 views
Serve PHP page in web root but show contents in subdirectories
I have a web site on a shared hosting server. My directory layout looks like this
/home
/user
/public_html
/pics
/family
There is an index.php file in ...
0
votes
2answers
110 views
.HTACCESS RewriteRule for 2 Domains
I have two domains, which content is in the same file directory:
http://www.alpha.com/
DIR: /var/www/alpha.com/
and
http://www.beta.com/
DIR: /var/www/beta.com/
I want to do the following ...
0
votes
1answer
287 views
Apache mod_rewrite to return a 404 except one directory
I'm trying to configure Apache to return a default 404 page when the / of DocumentRoot is called, except for some directories in that DocumentRoot
Unfortunately, I'm getting a 404 even for the ...
0
votes
1answer
53 views
Multiple Rewrite conditions and rules for custom paths
At the moment I have…
RewriteCond $1 !^(index\.php|img|css|js|fonts|jw|mail|uploads|user_guide)
RewriteRule ^(.*)$ /index.php/$1 [L]
However, I want to be able to rewrite a url like /page/about/ ...
0
votes
2answers
259 views
Matching more than one Query String with RewriteCond
I have the following configuration in an Apache configuration file for a CGI script:
RewriteEngine on
RewriteCond %{QUERY_STRING} !^/var/log/syslog-ng/JBoss.*$
RewriteRule ^/cgi-bin/(.*)$ ...
0
votes
1answer
124 views
Redirect homepage but not if there are query strings present
I want to redirect just the homepage of a Wordpress site but only if the original URL does not have any query strings on it. This works:
RedirectMatch 307 ^/$ ...
1
vote
2answers
779 views
htaccess with conditional rewritebase
I have a site (the-tack-shop.co.uk) in which I'm testing my e-commerce framework on. I was trying to test payment using a shared SSL: https://web43.secure-secure.co.uk/the-tack-shop.co.uk/.
I had to ...
0
votes
2answers
134 views
Help with Apache rewriteengine rules
I am trying to write a simple rewrite rule using the rewriteengine in apache. I want to redirect all traffic destined to a website unless the traffic originates from a specific IP address and the URI ...
0
votes
1answer
180 views
RewriteRule applying pattern even though 1 of the RewriteCond's failed
#www. domain . tld
RewriteCond %{HTTP_HOST} (?:.*\.)?([^.]+)\.(?:[^.]+)$
RewriteCond /home/%1/ ...
1
vote
1answer
67 views
mod_rewrite for specific domains in a mappings file
I have a bunch of domains that I want to go to one domain but various parts of that domain.
# this is what I currently have
RewriteEngine On
RewriteCond %{HTTP_HOST} ^.*\.?foo\.com$ [NC]
RewriteRule ...
0
votes
1answer
158 views
Compact Redirects in Apache/htaccess. How? [An Elegant Coding Question]
when setting my redirects in htaccess, i have trouble setting/combining various domains when they all go to the same homepage. I can do them separate, but that isn't neat/elegant. How to rewrite the ...
1
vote
2answers
76 views
Lazy Conditional Rule not doing anything! Why?
I am rewriting php generated thumbnails with igly urls into nice ones. instead of img.php?src=bla.jpg&w=200&h=100 the static filenames IMG-file_w200_h100.jpg
Because the rewrite is so ...
0
votes
2answers
3k views
RewriteCond in .htaccess file gives me bad flag delimiters
I'm upgrading a website and I use this .htaccess file to show maintenance page:
#MAINTENANCE-PAGE REDIRECT
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.0 # Bogus IP address for posting ...
0
votes
2answers
70 views
safe 301 redirection using htaccess for two domains
I have two domains, a new domain (newdomain.com) and and old legacy domain (olddomain.com). I want to safely redirect the old domain to the new domain. Easy enough.
At the moment I am doing this ...
1
vote
2answers
453 views
htaccess .html rewrite exception
Ok guys I need to add an exception! How can I do this?
I currently use RewriteRule ([^.]+).html $1 [R=301,L]
to rewrite all .html urls
I do need the exception for the google.html verification file. ...
1
vote
2answers
3k views
One RewriteCond for multiple RewriteRules
I need to preserve all user query strings.
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^$ index.html?page=home&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^about$ ...
2
votes
1answer
2k views
How to exclude a sub-folder from HTaccess RewriteRule
I have WordPress installed in my root directory, for which a RewriteRule is in place.
I need to password-protect a subfolder ("blue"), so I set the htaccess in that folder as such.
Problem is that ...
0
votes
2answers
486 views
Why does this mod_rewrite rule 'not-match'? (big rewrite log included)
I've got a scenario involving two domains:
WordPress site hosted on domain1.com
domain2.co.uk, simply redirecting users to domain1 via mod_rewrite
This rule applies irrespective of whether www. is ...
0
votes
2answers
194 views
RewriteRule dropping escaped parameter
I need some help with the following RewriteRule:
RewriteRule ^/iesearch/(.*)$ /jsp/search/ieaccelerators/visualsearch.jsp?q=$1 [L,PT]
The intention is to rewrite search-queries from ...
2
votes
1answer
116 views
unique .htaccess question about mod_rewrite and RewriteCond
I have a few rewrite rules like these
RewriteRule ^dir/(.*)-something.html otherdir/file1.php?var1=val&var2=$1 [L,NC]
RewriteRule ^dir/ otherdir/file2.php?var1=val [L,NC]
dir/ is not a real ...
0
votes
1answer
367 views
How to make RewriteCond+RewriteRule change domain2/folder1 to domain1/folder1
There's actually 2 questions.
One is, how do I make RewriteCond+RewriteRule change domain2/folder1 to domain1/folder1
Actually what I want is any domain that tries to access folder1 that is not ...
2
votes
1answer
5k views
How to exclude one subfolder from my RewriteRule Htaccess rules?
I have a .htaccess in my root of website that looks like this:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.mydomain\.pl [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?([a-z0-9_-]+)\.mydomain\.pl [NC]
...