Questions tagged [rewritecond]
128 questions
0
votes
1 answer
Redirect all the traffic from multiple domains to single domain using htaccess
I have hosted multiple websites on my server all sharing the same code base having one htaccess.
I need something like this.
if (domainname != example.com) redirect to example.com
if there any way of handling this from htaccess
used the…
![](../../users/profiles/350870.webp)
Harish Ninge Gowda
- 153
- 1
- 2
- 6
0
votes
0 answers
Case-insensitive fallback/redirect
I'm using some default images to show users the type of document that is used.
e.g. this image to show there is a .png file
In the /osr/icons/mime/ folder I have images for a multitude of files, e.g. avi.png, html.png, jpg.png, ...
So I simply…
![](../../users/profiles/146260.webp)
Pit
- 121
- 5
0
votes
1 answer
how to give subnets for IP addresses in rewrite condition?
I want to give subnet for various IPs while writing rewritecond. So how should i give the subnet mask in the below rule. the IP is 218.104.51.160/29
RewriteCond %{HTTP:X-Forwarded-For} !^IP
RewriteRule ^ - [F,L]
![](../../users/profiles/330529.webp)
Ankit
- 11
0
votes
1 answer
How do I prevent RewriteRules conflicting
I have three RewriteRules I am trying to implement but I cannot get all 3 to work together:
RewriteRule ^products$ http://%{SERVER_NAME}/en_ca/products [L,R=301]
RewriteRule ^products/(.*)$ http://%{SERVER_NAME}/en_ca/$1 [L,R=301]
RewriteRule…
![](../../users/profiles/321989.webp)
Rob Fyffe
- 103
- 1
0
votes
1 answer
.htaccess not behaving as desired
Eventhough I'm new at htaccess, I've been learning a lot in the past few days, but I'm stuck on a certain part that resulted in the website not behaving as desired. Here is the part of the code where I have my delima:
Options +FollowSymLinks…
![](../../users/profiles/315689.webp)
elrayyes
- 3
- 2
0
votes
1 answer
Have Apache serve static content instead of forwarding it to Plone (++resource++)
I have a Plone-based site, running behind Apache 2.4, which could perform a little better. One idea is to have Apache serve the static parts of the contents, preventing them from being rewritten for the Plone process, as is commonly…
![](../../users/profiles/113492.webp)
Tobias
- 165
- 1
- 9
0
votes
2 answers
how to write RewriteCond for a url with subdomain
I am trying to ban some bots by writing a RewriteCond rule in htaccess file. Is the following ruleset correct if I add the following:
## block traffic from particular referrers
RewriteEngine On
RewriteCond %{HTTP_REFERER}…
![](../../users/profiles/236061.webp)
developer
- 535
- 2
- 8
- 15
0
votes
1 answer
apache rewrite rules, non-www, https
I have two applications on the same server and use apache rewrite rules to redirect:
www requests to non www
http reuests to https
Everything works ok, except one case:
request www.test2.test.eu is redirect to https://www.test1.com content
How can…
![](../../users/profiles/197723.webp)
gaspar
- 133
- 1
- 10
0
votes
1 answer
Converting htaccess rewritecond to nginx
I'm very new to nginx, but have previous experience with apache redirects. I converting a subdomain to a subfolder and need some help with getting my rewrite rules correct for my switch. The subdomain is hosted on an apache server, with the new…
0
votes
1 answer
Route request to Tomcat only if file doesn't exist on disk
I have Apache in front of my Tomcat installation as a reverse proxy. Most URLs are routed to Tomcat by a JkMount directive in Apache.
For one URL pattern I'd like Apache to route requests to the Tomcat worker only if a static asset isn't found on…
![](../../users/profiles/23202.webp)
spiffytech
- 1,043
- 2
- 11
- 16
0
votes
1 answer
Nginx and complex URI rewrites
I'm having problem with getting logic behind Nginx rewrites. Are they supposed to be in server or location directive?
I need to rewrite one long and scary URL to another. Is there anyone who can help or at least show me resources to get this done?…
![](../../users/profiles/250172.webp)
Chris
- 1
0
votes
1 answer
apache rewrite rules for multimple domains | https://www
I have two applications configured on one apache (eg. example.com and test.net).
Rewrite rules for those apps are the same (so in config file for domain example.com I've got this rules, and the same rules in conf file for test.net…
![](../../users/profiles/197723.webp)
gaspar
- 133
- 1
- 10
0
votes
3 answers
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 its not working !! It is redirecting to…
![](../../users/profiles/232126.webp)
user3382916
- 11
- 1
- 3
0
votes
1 answer
Apache rewrite using THE_REQUEST for rewriting GET requests only
Background:
In order to reduce repo size of git repos containing wordpress installs, we are removing static assets from the repo. The bulk of the work is done, but I have a snag. I've relocated the assets to an S3 bucket and used an .htaccess…
![](../../users/profiles/210991.webp)
Nick Abbey
- 23
- 1
- 6
0
votes
1 answer
htaccess rewrite condition old site to new site with querystring
I am not even going to pretend to fully understand how htaccess rewrite conditions work. I've been working on this for a while searching and searching.
I have an old Wordpress site www.old-site.com and a new site www.site.com. Wordpress uses query…
![](../../users/profiles/195354.webp)
Brandon Braner
- 1
- 2