Questions tagged [rewritecond]
128 questions
0
votes
2 answers
.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 thing:
When user goes to
http://www.alpha.com/beta/
he…
![](../../users/profiles/94635.webp)
Max
- 1
0
votes
1 answer
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/ similarly so it is actually…
![](../../users/profiles/75734.webp)
user75734
- 11
- 2
0
votes
2 answers
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/(.*)$ /secure-cgi-bin/$1 [R=301,L,QSA]
The idea being that if…
![](../../users/profiles/14577.webp)
Rich
- 1,333
- 5
- 27
- 39
0
votes
1 answer
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 ^/$ http://www.consumerenergyreport.com/ticker
...but redirects URLs with queries. I…
![](../../users/profiles/72414.webp)
joshcanhelp
- 15
- 5
0
votes
2 answers
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 contains two specific strings.
RewriteEngine…
![](../../users/profiles/66385.webp)
Vinay
- 1
0
votes
1 answer
RewriteRule applying pattern even though 1 of the RewriteCond's failed
#www. domain . tld
RewriteCond %{HTTP_HOST} (?:.*\.)?([^.]+)\.(?:[^.]+)$
RewriteCond /home/%1/ -d
RewriteRule …
![](../../users/profiles/45937.webp)
ParoX
- 302
- 1
- 6
- 21
0
votes
1 answer
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 third paragraph sothat it works?
RewriteCond…
![](../../users/profiles/62346.webp)
Sam
- 403
- 3
- 7
- 23
0
votes
2 answers
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 using htaccess ModReWrite like so
# Redirect…
![](../../users/profiles/54579.webp)
Timmy O'Mahony
- 123
- 4
0
votes
2 answers
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 specified or not. (It's eventually removed from…
![](../../users/profiles/32054.webp)
Chris Woods
- 388
- 3
- 21
0
votes
2 answers
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 http://mydomain/iesearch/alvin+the+chip to a JSP. This works fine…
Gerd
0
votes
1 answer
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 domain1 gets switched to domain1. So for example …
gman
0
votes
1 answer
Is it possible to access a modified query string in a RewriteCond *after* applying a RewriteRule?
Is it possible to access a modified query string in a RewriteCond after applying a RewriteRule?
What I'm trying is to apply ...
RewriteCond %{QUERY_STRING} ^(.*)&?id=([^&]+)&?(.*)$ [NC]
RewriteRule ^/app\.jsp$ /app/%2?%1%3 [R=302]
... to rewrite…
![](../../users/profiles/968630.webp)
user27772
- 111
- 2
0
votes
0 answers
Language based RewriteRule like mysite.com/en/ in .htaccess
I'm trying to write redirect directives in the .htaccess to forward internally all user requests like this:
Every request in a language folder should redirect to the requested file with the language query string:
example.com/en/contact.php ->…
![](../../users/profiles/551453.webp)
denoise
- 53
- 6
0
votes
0 answers
Exclusion in Rewrite Rule
I have a rule in .htaccess redirecting all HTTP requests to HTTPS.
I need to exclude two specific paths because they are called by a legacy application to download a file, connecting using TLS 1.0 (which is not supported by the web server…
![](../../users/profiles/388731.webp)
RadioLontra
- 1
- 1
0
votes
1 answer
Configuring www.domain.com and domain.com with zonefile or letsencrypt to always forward to domain.com
I have a example that should always result in https://example.com, even when the user is entering www.example.com, https or not.
Ideally, the automated letsencrypt config https config file should work.
I have tried to remove the A-record for www…
![](../../users/profiles/214326.webp)
uncovery
- 295
- 2
- 12