0
votes
3answers
25 views

How to remove hypen (-) using nginx rewrite rule?

I am using this rewrite rule to redirect example.com/a-b-c?id=learn-more ----> http://example.com/abc?id=learnmore rewrite ^/a-b-c?id=learn-More http://example.com/abc?id=learnMore permanent But ...
-1
votes
1answer
55 views

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 ...
0
votes
0answers
15 views

Apache 2.2 rewrite (redirect) [duplicate]

I have a wordpress site that I'm having some issues doing proper redirecting to a new server and new url. Old server: http(s):\\devblog.server1.com New server: http(s):\\new.server2.com/dev/blog ...
1
vote
2answers
59 views

How to use mod_rewrite to abstract get request with subdomains

I've been at this all day and I thought I had a handle on regular expressions but I'm no longer confident that I do. I've searched all over, read through some horrible guides on mod_rewrite and I'm ...
1
vote
0answers
88 views

How to rewrite using htaccess if the file exists in another folder?

We are trying to rewrite to another folder if the file does not exist in the document root, but does exist in the other folder. The other folder is in a completely different location, which is ...
0
votes
0answers
58 views

How do you exlcude a sub-directory from an Apache rewrite ruleset?

I have a multilingual site with the root being English and a sub-directory (/es/) being a human translation into Spanish. Instead of manually updating all URLs, I have a opted to use mod_rewrite to ...
1
vote
1answer
92 views

RewriteCond always match incorrectly

If I write: <?php echo "SCRIPT_NAME: ".@$_SERVER['SCRIPT_NAME']."<br />"; ?> SCRIPT_NAME: /index.php The line above is showed. I'm using these rewrite lines RewriteCond ...
0
votes
3answers
2k views

How do I make RewriteCond %{HTTP_COOKIE} match a cookie value exactly? [duplicate]

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
103 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 ...
0
votes
1answer
99 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 ^(/)?$ ...
0
votes
2answers
321 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
61 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
185 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 ^(.*)$ ...
0
votes
2answers
145 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
1k 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
70 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 ...
0
votes
1answer
103 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
83 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
128 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
546 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
57 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
154 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
231 views

RewriteRule applying pattern even though 1 of the RewriteCond's failed

#www. domain . tld RewriteCond %{HTTP_HOST} (?:.*\.)?([^.]+)\.(?:[^.]+)$ RewriteCond /home/%1/ ...
0
votes
1answer
206 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
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 ...
2
votes
2answers
4k 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
552 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
214 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 ...
0
votes
1answer
388 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
6k 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] ...