Questions tagged [rewritecond]
132 questions
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…

Luke
- 183
- 11
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…

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…

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…

Rich
- 1,343
- 7
- 28
- 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…

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…

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 …

ParoX
- 302
- 1
- 7
- 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…

Sam
- 423
- 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…

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…

Chris Woods
- 398
- 3
- 22
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
Apache - Is it possible to rewrite urls based on fragments (hashtag)?
Using Apache/2.4.54 (Win64)
I have been requested to rewrite from old domain to new like this
From https://oldtest.mydomain.com/company/customerpage/#/customer//something
To…

rhellem
- 295
- 1
- 5
- 14
0
votes
1 answer
ErrorDocument not working for any error. Ubuntu Apache
I'm having an issue with getting the ErrorDocument to work. I have tried most of the suggestions on most of the forms and posts. The only thing I know that I have that the others did not is the RewriteCond that was added by certbot.
I have done it…

La Phyzz
- 1
- 1