All Questions

Tagged with
Filter by
Sorted by
Tagged with
0 votes
1 answer
93 views

Redirect rules for multiple enviroments

I have written a set of rules for 3 different environments on the same server. In a nutshell I would redirect the users to the Dev, Stage and Prod single sites. Also enforce https and www for the ...
Manoxs's user avatar
  • 1
2 votes
2 answers
3k views

.htaccess - Redirect all URLs with one exception

I want to redirect all URLs from one domain to another. Some of the old URLs have new counterparts with specific pages to redirect to. All other URLs should redirect to the homepage of the new domain. ...
Cray's user avatar
  • 135
1 vote
1 answer
658 views

htaccess: 301 redirect defined URLs to new domain and catch all redirect the rest

I want to redirect some URLs from an old domain to new versions on a new domain. The old domain uses the www. subdomain and SSL. For example: olddomain.com/audi -> newdomain.com/cars/audi ...
Cray's user avatar
  • 135
1 vote
1 answer
160 views

How Can We Do 301 Redirect Of Over 200 Pages To Corresponding 200 Pages At New Location?

I need help and need it fast. We recently migrated a subdomain to integrate with the domain. Eg. https://blog.example.com to https://www.example.com/blog https://blog.example.com has a ton of traffic ...
user18571's user avatar
2 votes
1 answer
2k views

Redirect part of a URL parameter to the URL-Path

I used a module that created links like this: https://example.com/login?create_account=1&back=https://example.com/product/2164/?ets_rv_add_review=1 I need to redirect them to: https://example.com/...
Ehsanai's user avatar
  • 21
-1 votes
1 answer
40 views

Simple IP/URL Redirection

We have a web application that each user has their own address like our-app.com/user1. Our users want to use their own domain and redirect to their pages on our app. For example www.user1.com => ...
jsonx's user avatar
  • 99
0 votes
1 answer
710 views

Redirect all pages to non www and one page to www

I want to redirect all my internal pages (eg: example.com/about) to their non-www version but I want my homepage (https://example.com) to redirect to its www version (https://www.example.com). I ...
Excellent Exim House's user avatar
0 votes
1 answer
606 views

Apache, redirect for a moved directory

On our webserver a directory has been "copied" from one location to another. Now the original location is gone however I am receiving requests to provide a redirect to the new location. I ...
Chris Woelkers's user avatar
1 vote
1 answer
119 views

Redirect the document root and a specific page only to another domain

Might sound confusing, but what I want to achieve is this: If the user visits: www.mydomain.com (with or without www.) transfer them to: www.myotherdomain.com/welcome-old-users At the same time, I ...
Paloma Martinez's user avatar
2 votes
1 answer
108 views

.htaccess redirect/rewrite many domains to many domains

My idea is: requests to service.example.com should be redirected to service.example.com, all the other requests to example.com should be redirected to base.example.com My host is configured in such ...
Tomek's user avatar
  • 21
2 votes
1 answer
1k views

HSTS and Wordpress redirection to www and non-www and https - avoid multiple redirections?

I am trying to implement the HSTS (HTTP Strict Transport Security) on my Wordpress site, but I am not getting any success. First I had managed to redirect my site from non-www to www , and including ...
mlclm's user avatar
  • 169
2 votes
1 answer
258 views

Dynamic DocumentRoot Based on SSL (Client Auth.)

I currently use Client SSL authentication to protect sensitive content. Users are required to import a certificate into their browsers that we generated using OpenSSL. When a user visits the website, ...
Ralph's user avatar
  • 882
1 vote
1 answer
250 views

How do I 301 redirect some specific URLs - including the root - to specific locations, and then everything else to the new root?

I'm struggling with a .htaccess mod_rewrite challenge. Help is appreciated. I want the following 301 redirects to work: mysite.com > https://newsite.com/subdirectory/ mysite.com/old_page_1/ > ...
PhilSmully's user avatar
1 vote
1 answer
1k views

Apache mod_rewrite with Redirect Dropping Authorization Header

I have some Apache mod_rewrite rules set up to redirect Maven deploys from one url/server to another. We're in the process of migrating from Nexus to Artifactory and need these redirects set up so ...
user avatar
2 votes
1 answer
2k views

Redirect link with query string, but only from specific page

My problem is about that I want to redirect links that contains specific phrase and specific query string after question mark. For example - redirect from: http://example.com/first-category?p=1 to: ...
oska's user avatar
  • 33
3 votes
1 answer
773 views

Redirect all URLs from http to https (with 301 ) except for a few [duplicate]

I am trying to 301 redirect all URLs from http:// to https://, using .htaccess. Some dynamically generated URLs should be excluded. Example of some URLs I do not want to redirect: example.com/tt....
Rogge's user avatar
  • 33
0 votes
1 answer
2k views

htaccess - .htaccess in sub directory not inheriting .htaccess in root directory

i have 2 .htaccess files first in /public_html/ #ErrorDocument 404 https://example.com/en/404.php RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://example.com/$1 [R,L] ...
Amr Ahmed's user avatar
1 vote
1 answer
620 views

htaccess rewrite country without subdomains

i need to rewrite URL from us.example.com to example.com?country=us without subdomains I tried these 2 rules: 1. RewriteRule (US|EG) ?c=$1 [NC , L] 2. RewriteRule :\/\/(.*?).example.com ?C=$...
Amr Ahmed's user avatar
3 votes
1 answer
5k views

If file exists, redirect to a certain file, else redirect to 404 from htaccess

I have this tree: libs/ html/ app/ uploads/ files/ images/ male.png female.png .htaccess download.php .htaccess index.php /.htaccess has this content: <IfModule ...
Arșavin's user avatar
0 votes
1 answer
54 views

Multiple redirects with 301 apache from https://domain.tld to https://domain.tld/subdir/

I have the current setup with Apache2, lets encrypt to move http://domain.tld => https://domain.tld http://www.domain.tld => https://www.domain.tld Its working perfect, Now I wanted move ...
indianwebdevil's user avatar
2 votes
1 answer
102 views

How to redirect/rewrite a domain-1/dir1/dir2/* to another domain-2/dir1/dir2/* in htaccess?

I'm trying to redirect all URLS from one directory in one domain to the same directory to another domain on the same server, and could not make it work. How do I solve this problem? I have tried: ...
Emma's user avatar
  • 121
1 vote
1 answer
6k views

How to redirect from one subfolder to a subsubfolder with htaccess

I have this folder structure: /fonts /myfont.eot /myfont.svg /myfont.ttf /myfont.woff /myfont.woff2 /content /page1 /files /logo.png /style.css /index.html /page2 ...
LWChris's user avatar
  • 111
2 votes
1 answer
831 views

Block the access of random url paths with Apache mod_rewrite

This is the link to my website manuals: https://www.example.com/manual/ch016_user-moves.xhtml but unfortunately it can be accessed also this way : https://www.example.com/manual/blablablafoobar/...
s.rio's user avatar
  • 23
2 votes
1 answer
925 views

Decoding a Rewritten URL using mod_rewrite - htaccess - regex

I am using Apache 2.4. I have set up and configured an Apache HTTP server, to host my invision app, my app is linked to external google docs. I am trying to redirect to an external google doc from the ...
cannybiscuit's user avatar
2 votes
1 answer
2k views

Getting "302 Found" even after redirecting to a specific file in the .htaccess

I have an Apache server hosted on an EC2 instance which points to a domain that I own. Now, what I essentially want to get done is that the web server should return a .json file when the user tries to ...
jait's user avatar
  • 23
1 vote
1 answer
158 views

Apache Rewrite not working

I have a very strange thing happening in my apache2 setup. I just want to redirect HTTP to HTTPS. I have tried all possible ways, like this: RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^/?...
user2908112's user avatar
1 vote
1 answer
7k views

Why are Apache Rewrite Conditions not working?

I tried to perform a redirect writing in .htaccess file: RewriteEngine on RewriteRule article-1 www.another-site.com/article-1 [R=301,L,NC] and it works correctly. Anyway, when I add a rewrite ...
Arthu83's user avatar
  • 11
9 votes
1 answer
3k views

HSTS and double redirect

I manage a little website in a shared hosting LAMP environment: this basically means the only thing I can edit is an htaccess file. I wanted to add HSTS support (and I did it), but, when I tested my ...
user avatar
0 votes
1 answer
176 views

Using mod_rewrite to redirect single pages

The first requirement was to redirect traffic from http://www.old-domain.org to https://example.press -- but only do so for the root of the domain; any specific page should be available on the old ...
alexakarpov's user avatar
1 vote
2 answers
264 views

Dirty redirects in .htaccess

text/x-generic .htaccess ( UTF-8 Unicode text ) RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] # BEGIN WordPress <IfModule mod_rewrite.c> ...
Netizen110's user avatar
2 votes
0 answers
97 views

HTTPS redirect, exclude script parameters from URL [closed]

My goals: 1. http://example.com/page/index.php -> https://example.com/page/ 2. http://example.com/page/ -> https://example.com/page/ 3. http://www.example.com/page/ -> https://example.com/...
Yury Osipenko's user avatar
1 vote
1 answer
3k views

Apache: Redirect all .html AND .php requests to folder + WordPress

After a relaunch I have a bunch of dead backlinks pointing at URLs with .php or .html file-extensions. It would be nice to redirect them in bulk using .htaccess and the mod_rewrite module. The ...
schuggerleo's user avatar
2 votes
1 answer
980 views

apache2 mod_rewrite redirect without http body [duplicate]

I am currently using Apache mod_rewrite to redirect to HTTPS, but I would like to remove the body from the response. How it is currently: Example: How I would like it to be My redirect ...
reddot2k's user avatar
0 votes
1 answer
11k 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 ...
Hansilog's user avatar
2 votes
2 answers
1k views

Redirect old domain to new domain with same URL structure

I am trying to redirect URLs at my old WordPress domain to the same URL structure but at my new domain. So for example: oldsite.com/post-name-1 would redirect to newsite.com/post-name-1 oldsite.com/...
BuiltBySam's user avatar
0 votes
0 answers
649 views

Keep redirect URL after redirecting in destination server reverse proxy

I use Apache as reverse proxy for email web access. Proxy works fine when I connect to login page. I see url email-test.example.com. Unfortunately after login in email server is redirect back to email....
Ian's user avatar
  • 1
-2 votes
1 answer
498 views

how to redirect old html url to new php Url [duplicate]

How to redirect old html page to new php page. I used this code but it redirecting with full file path. I'm using below code. RewriteEngine On RewriteRule ^(.*).html$ $1.php
Piyush's user avatar
  • 1
3 votes
1 answer
93 views

Complicated mod-rewrite

I have a requirement from a customer to perform some specific redirects (part of decomissioning an old server to a new one). I've been banging my head against this and it's driving me nuts! In effect,...
Pete Mallam's user avatar
1 vote
1 answer
120 views

How serve different content using apache and (maybe) mod_rewrite

There are some files (with unique names) in a directory structure like this: /var/www/domain1/unique_filename1 /var/www/domain2/unique_filename2 /var/www/domain3/unique_filename3 At the moment, all ...
Ehsan Khodarahmi's user avatar
0 votes
1 answer
35 views

Trying to determine between rewrite, redirect or proxy for an Apache Application server

I am running an Apache web application server internally, at App.domain.com. It is exposed externally by using port forwarding at the firewall/gateway as app.domain.com:10080. Access generally works ...
Gerry G.'s user avatar
0 votes
1 answer
1k views

URL without "https://" does not work in Apache

I am using Apache as a proxy server for my web application wich is running in a Glassfish container. I configured the proxy pass and also SSL in Apache. The site can be accessed from outside with the ...
Lakshi's user avatar
  • 101
6 votes
2 answers
14k views

Redirect all urls to the root except /wp-admin and wp-json

I try to redirect all urls to the root except for the wordpress administration and the wordpress REST API. I have these rules in my .htaccess: <IfModule mod_rewrite.c> RewriteEngine On ...
Quentin Brosse's user avatar
0 votes
1 answer
2k views

htaccess redirect all traffic on specific domain to another domain, exclude folder and filetype [duplicate]

Multiple alias domains pointing to the same cPanel account are sharing the same .htaccess file. I need a domain-specific rule that redirects all traffic from aliasdomain.com to https://www.domain1.com ...
comdex420's user avatar
0 votes
1 answer
9k views

ERR_TOO_MANY_REDIRECTS using Virtual Hosts

I'm getting an ERR_TOO_MANY_REDIRECTS when entering my website, using Google Chrome. I'm not using any rewrite module. This is my website configuration: (Literally a Virtual Host) <VirtualHost *:...
user avatar
0 votes
2 answers
151 views

How to redirect /services to /services/onetime?

Through htaccess file I am trying to redirect /services to /services/onetime but its redirecting me to /services/onetime/onetime/onetime/... What is the problem with the code and is there a way to do ...
Vikram's user avatar
  • 167
4 votes
3 answers
5k views

Apache RewriteMap with URLs containing space doesn't work

I am actually using a RewriteMap directive inside my vhost to redirect a list of 800 URLs. It works quiet well: RewriteEngine On RewriteMap redirects dbm=db:/data/apps/project/current/configuration/...
COil's user avatar
  • 207
0 votes
1 answer
1k views

Redirect subpages to parent-directory

I want to redirect all requests for subpages to the directory root. Unfortunately I only get redirect loops. Here is a sample of my .htaccess-file: RewriteEngine On RewriteBase / RewriteCond %{...
schuggerleo's user avatar
0 votes
1 answer
77 views

Can i redirect only my mainpage to www

When i past this code, it redirects my whole website. But when i want to go to ticket.mysite.com it gives me the 404 because it redirects me to www.ticket.mysite.com but i don't want this with a ...
MaikelVE's user avatar
0 votes
1 answer
666 views

Mod_rewrite: Redirect to url in query string

Apache server receives request in following format http://192.168.110.65/?http%3A%2F%2Fdev.virtualearth.net How do I have Apache generate a redirect to the query string using mod_rewrite http%3A%2F%...
Rama Arjun's user avatar
0 votes
1 answer
46 views

Is there a way of writing cleaner rewrite rules if you've a large number of redirects to implement

I recentley completed a project whereby I moved a pretty large website to a nice clean smaller website. What this meant was I had to account for a large number of pages that had been indexed by search ...
Javacadabra's user avatar