The tag has no usage guidance.

learn more… | top users | synonyms

0
votes
1answer
26 views

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 ...
1
vote
1answer
19 views

Having issues with my websites htaccess

I recently uploaded a PHP theme on my server. It's working fine on any other sections except my home page. For example, when accessing www.mywebsite.com/anything the theme is working but when on ...
1
vote
0answers
411 views

htaccess: Is it possible to ask with rewritecond if the request was already redirect? [closed]

I'm having a redirect loop and it could be solved by asking with rewritecond if this is the first time since user request, or it's jumping already. Is it posibble to know inside .htaccess? Thanks in ...
0
votes
0answers
36 views

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, ...
-2
votes
1answer
23 views

how would i create rule for a particular subdomain in uppercase? e.g XX.test.com

I am new to system admin side. I need to create one subdomain with capital letters. e.g our main URL will be test.com and one of our sub-domain will be SS then instead of writing ss.test.com I want ...
0
votes
1answer
29 views

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

RewriteRule — how to serve file from subdirectory, but show requested URL using only .htaccess

I want to be able to switch between dev/live subdirectories without altering the URL that displays in the browser and without having to modify httpd.conf. I want https://domain.com to actually serve ...
2
votes
1answer
25 views

Something like foreach in htaccesss?

I am in this situation: url: domain/var1/var2/var3/.../varn And I want to change that url in: url: domain?v1=var1&v2=var2&v3=var3/.../&vn=varn I found this way: RewriteRule ...
1
vote
0answers
12 views

How to provide read access to a folder and its files via htaccess

This is probably trivially easy but after RTFM'ing and trying several things I seem to be a bit stuck... The current version "appears" to let me access the directory BUT NOT the files via the ...
0
votes
0answers
26 views

Use Environment Variable on RewriteCond's Condpattern

I could successfully access a variable from .htaccess that I define on the VirtualHost declaration. This, using SetEnvInf which runs before the Rewrite rules. The only place where I can't access it, ...
0
votes
1answer
13 views

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/(.*)$ ...
0
votes
0answers
9 views

Weird request, trying to correct with rewrite rule

I've got some really weird requests coming into the site. We've tried replicating in all browsers, mobile, tablets, etc etc... but still can't figure it out! As an intermediary, we are trying to force ...
0
votes
1answer
15 views

.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 ...
-2
votes
1answer
68 views

apache: prepend a string literal to a TestString in a RewriteCond for mod_rewrite [duplicate]

So I can clearly do this: RewriteCond %{REQUEST_FILENAME}\.php -f But I cannot do this: RewriteCond some_directory/%{REQUEST_FILENAME}\.php -f Furthermore, this also fails: RewriteCond ...
0
votes
1answer
76 views

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 ...
0
votes
1answer
108 views

Nginx try_files instead of IFs to accomplish conditional logic

I'm trying to create Nginx vhost configs that will include the equivalent of the Apache htaccess rewrite rules for OpenCart. Here is the orignal: RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f ...
0
votes
0answers
44 views

Apache RewriteCond [duplicate]

I am using GeoIP to forward requests from different countries to different sites and I was wondering if it is possible to use OR operator in RewriteCond. I tried to look it up from the documentation ...
0
votes
2answers
115 views

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

How to rewrite URI from root if file doesn't exists in folder?

I have a static folder which is not in my document root. I would like to redirect all the files that are not present in document root, but are present in the static folder. (So if the same file is in ...
1
vote
1answer
28 views

URL rewriting a specific directory

I want to rewrite the URL when receiving a request that is not a file and either for directory subdir or not a directory at all. E.g. (!file) && ( (subdir ) | ( !directory ) ) Here's my ...
1
vote
0answers
50 views

Apache rewrite rule for multiple named virtual hosts with a 'catch all' rule

I have a redirect apache server that I setup for about 30 domains. I want to have all requests get redirected to the main server except for 1 domain. Basically any domain coming to this server gets ...
0
votes
1answer
398 views

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 ...
0
votes
1answer
606 views

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 ...
0
votes
1answer
91 views

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 ...
0
votes
1answer
142 views

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 ...
0
votes
1answer
70 views

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 ...
-3
votes
2answers
108 views

Apache redirect to parent folder [closed]

I have a server pointing to DocumentRoot /var/www/mysite I would like to redirect all requests from /var/www/mysite/folder/ to /var/www/mysite/ I tried the following: `RedirectMatch ...
0
votes
3answers
74 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 ...
0
votes
1answer
2k views

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 ...
0
votes
1answer
893 views

VirtualHost Redirect should work with new RewriteBase

Inside the VirtualHost I got this redirect: RewriteBase / RewriteCond %{REQUEST_URI} wp-content/uploads/([^.]+\.(jpe?g|gif|bmp|png))$ RewriteRule (.*) http://example.org/$1 [R=301,L,NC] So the full ...
-1
votes
1answer
921 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 ...
-1
votes
1answer
390 views

Block Wildcard User-agent

how can i write rewrite condition for wildcard user agents here is the code I'm trying but doesnt work RewriteCond %{HTTP_USER_AGENT} !*uTorrent* [NC] RewriteCond %{HTTP_USER_AGENT} ...
1
vote
2answers
99 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
1answer
617 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
1answer
366 views

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 ...
-3
votes
2answers
605 views

Mod Rewrite code with out changing the url in address bar

I When I call http://www.mysite.in/abc/xyz it shoud show up http://www.mysite.in/abc/xyz/index.php but the url shout not change in address bar and it should work with out "/" in the address. Please ...
0
votes
1answer
415 views

SSL/TLS Client certificate Authentication using RewriteCond and Rewrite Rules to perceptively redirect traffic not authorized

I finally end up to write here because I´m badly struggling against apache, SSL/TLS and a client certificate authentication that should use the certificate´s Serial Number to restrict access to a ...
1
vote
1answer
344 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 ...
2
votes
1answer
2k views

ProxyPass if RewriteCond is TRUE

At proxypass configuration file I have written this line ProxyPass /directory/ ajp://localhost:8009/directory/ It works perfectly At htaccess file RewriteRule ^seconddirectory/(.*)$ ...
0
votes
1answer
6k views

RewriteCond not matching on my IP when matching on %{REMOTE_ADDR} [duplicate]

I want a mod_rewrite rule not to be executed when traffic is hitting the web-server from internal network. The web server is an apache 2.2 The following RewriteCond is meant to guard the rewrite rule. ...
-1
votes
1answer
476 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 ^(.*)$ ...
2
votes
3answers
8k 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
48 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
226 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
163 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
2k 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
855 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
113 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
340 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
592 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 ...