Linked Questions

7
votes
5answers
86k views

How do I use .htaccess to always redirect from HTTP to HTTPS? [duplicate]

There's a few similar questions which I tried to work out the answer from, but so far I have been unsuccessful. Please advise how I can always redirect http to https (and also remove www. from the ...
17
votes
1answer
19k views

How to add exceptions to apache reverse proxy rules [duplicate]

I am trying to set a Apache reverse proxy so that requests get proxyed to another application running on 8080. However, I want some directories to be directly served rather than forwarded to proxy. ...
2
votes
6answers
18k views

Redirect from http to https [duplicate]

I have a Hudson/Jenkins installation which runs on port 443, so I can access it with https://ci.mydomain.com. I do not have a webserver running on port 80 like Apache Httpd, but I want if a user types ...
6
votes
3answers
20k 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] ...
2
votes
4answers
16k views

Apache webserver: How to redirect all requests to domain.com to www.domain.com [duplicate]

Something like this works for the index page: <VirtualHost *:80> ServerName example.com Redirect permanent / http://www.example.com </VirtualHost> <VirtualHost *:80> ServerName ...
3
votes
2answers
13k views

.htaccess - redirect non www to www and retain subdomains from redirecting [duplicate]

So, on my main domain 'domain.com' I created several subdomains from cPanel, like 'sub1.domain.com' and 'sub2.domain.com'. Their real location on server is in 'domain.com/sub1' and 'domain.com/sub2'. ...
2
votes
2answers
8k views

apache force if url has specific pattern redirect to https [duplicate]

How can I force Apache if URI start with "admin-" pattern or contain "admin/user/login" redirect to https of the same uri. For example: If the URI is : http://examplesite.com/admin-2dns24dw ...
1
vote
1answer
12k 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
vote
1answer
3k views

How do you prevent mod_rewrite from decoding a string in the path? [duplicate]

I'm trying to create a restful API using mod_rewrite. I have the rule: RewriteRule v2/(.*)$ v1/index.php?request=$1 [QSA,NC,L] However the path could contain base64 encoded strings (i.e. can have ...
0
votes
1answer
9k views

Apache: too many redirects [duplicate]

My Scenario: i have running apache severing my UI and i have my node api running on port 2000 and i have a reserves proxy on apache to proxy request to api and i have configure ssl as well and i want ...
1
vote
2answers
5k views

How to set mod_rewrite in WAMP? [duplicate]

I learn Symfony2 and i have: http://symfony.com/doc/current/quick_tour/the_big_picture.html http://localhost/Symfony/web/app.php/demo/hello/Fabien And if you use Apache with mod_rewrite enabled, ...
1
vote
1answer
5k views

Rewrite a directory to another directory without a redirect [duplicate]

I have the following rewrite rule: RewriteRule ^support/(.*)$ /blog/support/$1 [R=301,NC,L] However, all it does is a simple redirect. What I want to is for /support to show the contents of /blog/...
1
vote
2answers
2k views

How can I use mod_rewrite to remove everything after the ? (question mark) in a URL? [duplicate]

How can I use mod_rewrite to remove everything after the ? (question mark) in a URL? For instance: http://127.0.0.1/ALL_FILES.php?test=1 after mod_rewrite: http://127.0.0.1/ALL_FILES.php For php ...
2
votes
1answer
6k views

How to get hostname into rewriterule [duplicate]

We've got a few subdomains setup, and I want to simplify some apache configuration - particularly as these particular subdomains are volatile. Anyway, I'm trying to get a rewrite rule that include the ...
0
votes
1answer
8k views

Redirect specific IP using htaccess [duplicate]

I am trying to figure out if it is possible to do a 301 redirect for a particular IP address (in this case brute force password bot). I want to send this guy to a project honeypot link rather than ...
0
votes
1answer
4k views

redirect all subdomains from http to https [duplicate]

I redirect all http requests for my subdomain to https by using following code. <VirtualHost *:80> ServerName subdomain.example.com Redirect 302 / https://subdomain.example.com </...
1
vote
1answer
5k views

http to https including www 301 redirect [duplicate]

I currently have our Magento website to redirect http to https. Basically the site should only be accessed through https including the www. I think it is working however, it currently shows as a 302 ...
1
vote
1answer
4k views

how to stop htaccess URL redirect loop [duplicate]

I am new to htaccess. so when i want to do a url redirect using htacces, i always get a redirect loop, and don't know how to fix it. I have been searching on the web but coundn't find a solution for ...
0
votes
1answer
3k views

apache redirect only root slash homepage [duplicate]

I need to redirect only http://example.org/ to http://www.something-other.org/ in Apache 2.4. Just the homepage. Nothing else. I.e. http://example.org/?page=blog or http://example.org/contact.html ...
1
vote
1answer
4k views

Apache mod_proxy+mod_rewrite = “Request exceeded the limit …” error [duplicate]

Good day, I'm using Apache as a reverse proxy for my Tornado app which runs on http://localhost:8090. I want Apache to proxy everything that arrives to /api/v2 through HTTPS to http://localhost:8090. ...
-1
votes
2answers
3k views

Rewrite only if Image don't exists with .htaccess [duplicate]

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

Apache2: Handling a subdirectory in another VirtualHost [duplicate]

I have a site with forums. The forums are currently at forums.example.com (a subdomain). I've heard that for SEO and usability in general it's better to have them at example.com/forums. Regarding ...
0
votes
1answer
5k views

Apache rewrite rule to redirect a URL with parameters to a URL without parameters [duplicate]

I want to go from: www.website.com/directory/results?category=10&dir=asc to www.website.com/staticfile.html I tried the following and it doesn't seem to catch: RewriteRule "^directory\/...
0
votes
1answer
4k views

How to configure a base URL in Apache? [duplicate]

I have the following problem: The Apache DocumentRoot is /var/www/. The URL of the file one should get when browsing http://www.example.com/ is http://www.example.com/_www/en/home.html So I ...
-1
votes
1answer
4k views

Apache Rewrite redirect all pages except for specific [duplicate]

I am retiring a site and would like to display a message when anyone tries to access any page on the site EXCEPT for a couple of pages. Some pages have certain pageid parameters. So basically ...
-1
votes
1answer
2k views

Apache htaccess get subdomain and prepend it to path [duplicate]

this is my first question on ServerFault and I think I couldn't find a similar one. To the point. I would like to achieve the following using my .htaccess. subdomaina.example.com/stats/ -> ...
1
vote
2answers
3k views

How can I remove trailing slash with .htaccess on localhost with UniServer [duplicate]

I want to remove the last trailing slash of a URL. For example: I want to http://localhost/mysite/page/ rewrite to http://localhost/mysite/page. I'm using this code on my localhost .htaccess. ...
-1
votes
2answers
2k views

Strip part of URI with mod_rewrite [duplicate]

I have this rewrite rule to direct request to my symfony 2 application: RewriteCond %{REQUEST_URI} ^/foo/.*$ RewriteRule ^/foo(/.*)$ /srv/webapps/symfony2/web/app.php [QSA,L] ...
-4
votes
1answer
856 views

Redirect only one website to https [duplicate]

I have one serveur with multiple domains. I'd like to redirect only one "site-internet.com" to ssl configuration. I'd like to do : www.site-internet.com => https://www.site-internet.com site-...
-1
votes
1answer
3k views

“Simple” .htaccess rewrite for sites in subfolders not working [duplicate]

I have a catch-all Apache virtual host in /var/www/. In it, I have a index.php that handles all the code for pages, and subfolders holding the resources for each site (images, css, etc). I want a ...

15 30 50 per page