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

mod_rewrite “Request exceeded the limit of 10 internal redirects due to probable configuration error.” [duplicate]

What i want: Force www [works] Restrict access to .inc.php [works] Force redirection of abc.php to /abc/ Removal of extension from url Add a trailing slash if needed old .htaccess : Options +...
0
votes
2answers
2k views

Apache server config redirect from IP to domain name EC2 [duplicate]

I am running an apache webserver on a linux EC2 instance. The problem is that you can access the server using the IP address, DNS and the domain name. This causes a problem for SEO and I want to tidy ...
3
votes
1answer
3k views

Subdomain doesn't work without www in front of it [duplicate]

I had a subdomain setup in cpanel before (sub.domain.com to redirect to domain.com/sub/) and suddenly today I noticed that it was rewriting the URL in the browser to www.domain.com/sub/ instead of ...
0
votes
3answers
1k views

Rewrite example.com to www.example.com [duplicate]

I want to rewrite urls to the www subdomain if the user omits it, i.e. example.com/something.html to www.example.com/something.html The config below doesn't work, user remains on example.com. There's ...
-1
votes
2answers
1k views

Where should put RewriteCond and RewriteRule? [duplicate]

I am using Apache as the HTTP server in order for me to access the Subversion repository, since I don't find any .htaccess file as I am not tied the svn directory to /var/www, can I put the ...
-1
votes
1answer
3k views

Redirection of http to https not working [duplicate]

I want to redirect my subdomain to https. My .htaccess file contains the following: RewriteEngine On RewriteCond %{HTTPS} !on RewriteRule (.*) https: //%{HTTP_HOST}%{REQUEST_URI} It's redirecting to ...
0
votes
1answer
1k views

mod_rewrite and redirecting on exact match [duplicate]

Possible Duplicate: Everything You Ever Wanted to Know about Mod_Rewrite Rules but Were Afraid to Ask? I want to redirect http://www.name.com and http://name.com/ to http://my.name.com/. ...
0
votes
1answer
2k views

HTTPS redirect, exclude subdomain - Opencart [duplicate]

I just switched to HTTPS on my server. Could you please help me with .htaccess to redirect all traffic to https://, exclude subdomains: www.example.com -> https://example.com example.com -> ...
0
votes
1answer
2k views

Help With Infinite Redirect From .htaccess using MVC with PHP [duplicate]

Let me preface by saying that I'm fairly new to .htaccess authoring and have usually left the nitty gritty up to my hosting provider. I've recently decided to implement a hand rolled MVC framework in ...
0
votes
1answer
2k views

htaccess rewriterules for multiple pages with parameters [duplicate]

In main page index.php I have two href (like menu) for objective.php and news.php For both objectives and news I sent variables like: <a href="objectives.php?menu=corporate-objectives"> <...
0
votes
1answer
2k views

force HTTP to HTTPS Centos 6.7 and Apache not working correctly [duplicate]

I tried adding to the .htaccess file RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://mywebsite.com/$1 [R=301,:] I also tried (in the httpd.conf file) <VirtualHost *:80&...
0
votes
3answers
1k views

how to strip string from url using rewrite rule [duplicate]

Possible Duplicate: Everything You Ever Wanted to Know about Mod_Rewrite Rules but Were Afraid to Ask? sometimes my drupal site add extra string to image url which causes the image to be broken. ...
0
votes
1answer
947 views

How to redirect a sub-directory to the root [duplicate]

I have Apache running for a Joomla! site The site is CBSL, under www (so www\cbsl\index.php) To access it my user have to code http:\mysite\cbsl Is there a way to configure Apache so that http:\mysite ...
-1
votes
1answer
2k views

Redirect domain to specific URL on other domain [duplicate]

I have got apache2 server with one virtual host. It is typo3 CMS. There are multiple pages: foo.com -- DNS A record --> 32.32.32.32 |_ foo.com/bar/ |_ foo.com/baz/ Now I want to configure ...
0
votes
1answer
1k views

Apache2 mod_rewrite redirect all except one folder [duplicate]

I need to redirect the requests for my old website (www.old.com) to the new domain (www.new.com) but I would like to keep the old content available in a different folder (www.old.com/oldsite). I've ...
1
vote
1answer
2k views

Request exceeded the limit of 10 internal redirects due to probable configuration error [duplicate]

While entering my website via the main page (example.com) everything works fine. But when entering in example.com/forums I get a 500 Internal Error, and I see in the error_log it says the following: ...
0
votes
2answers
2k views

Apache mod_rewrite : RewriteRule to pass requests tomcat application [duplicate]

I am having difficulty defining a correct RewriteRule to forward requests to an application running in tomcat. I have apache with mod_rewrite enabled as well as tomcat setup with an application ...
3
votes
1answer
2k views

How to exclude IP from htaccess domain redirect [duplicate]

I'm trying to write a custom redirect rule for some testing purposes on 2 domains with exactly same site. The code I am using is: RewriteEngine on RewriteCond %{REMOTE_ADDR} !^1\.2\.3\.4$ ...
-1
votes
1answer
2k views

.htaccess redirection for alias domain [duplicate]

I have two domains named www.example.com and www.example-alias.com , Both domain are pointing same location in the server. I need to do 301 redirection for www.example.com to www.example-alias.com &...
0
votes
1answer
2k views

.htaccess redirect only when URL doesnt match a specific URL [duplicate]

In our app we allow custom domains, so a user can create: custom.my.example.com Which we map to: app.our.example.com In our app we enforce SSL, except for when the user enters a preview URL such ...

15 30 50 per page