htaccess 301 redirect entire site but with exceptions.htaccess redirect all urls to x except redirect 1 to y and allow some to stay as isMulti-Wordpress rewriterules in 301 with exception for one subdomainHow to manage a redirect request after a jQuery Ajax callGeneric htaccess redirect www to non-wwwHow do I redirect to another webpage?How do I make a redirect in PHP?How can I redirect and append both stdout and stderr to a file with Bash?Tips for debugging .htaccess rewrite ruleshtaccess redirect to https://www301 Redirect entire site to new directory except for index.html landing page.htaccess extensionless url and 301 redirect loopHtaccess URLs redirects are working for http not all https
How can I close a gap between my fence and my neighbor's that's on his side of the property line?
What happens if I start too many background jobs?
Selecting a secure PIN for building access
How could a planet have most of its water in the atmosphere?
CRT Oscilloscope - part of the plot is missing
Password expiration with Password manager
I caught several of my students plagiarizing. Could it be my fault as a teacher?
What does air vanishing on contact sound like?
I lost my Irish passport. Can I travel to Thailand and back from the UK using my US passport?
What happened to Rhaegal?
Any examples of headwear for races with animal ears?
If 1. e4 c6 is considered as a sound defense for black, why is 1. c3 so rare?
Who died in the Game of Thrones episode, "The Long Night"?
Why do freehub and cassette have only one position that matches?
Copy line and insert it in a new position with sed or awk
Is there a QGIS plugin that reclassify raster symbology based on current extent?
How to back up a running Linode server?
Floor tile layout process?
How to creep the reader out with what seems like a normal person?
Hang 20lb projector screen on Hardieplank
How to implement float hashing with approximate equality
Visualizing a complicated Region
Survey Confirmation - Emphasize the question or the answer?
Does hiding behind 5-ft-wide cover give full cover?
htaccess 301 redirect entire site but with exceptions
.htaccess redirect all urls to x except redirect 1 to y and allow some to stay as isMulti-Wordpress rewriterules in 301 with exception for one subdomainHow to manage a redirect request after a jQuery Ajax callGeneric htaccess redirect www to non-wwwHow do I redirect to another webpage?How do I make a redirect in PHP?How can I redirect and append both stdout and stderr to a file with Bash?Tips for debugging .htaccess rewrite ruleshtaccess redirect to https://www301 Redirect entire site to new directory except for index.html landing page.htaccess extensionless url and 301 redirect loopHtaccess URLs redirects are working for http not all https
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I am trying to create an htaccess file to redirect my entire site except with some exceptions, but I can't get it working. I need to redirect the entire thing, provide a specific redirect, and exclude two pages. Below is my non-working sample. Thanks!
RewriteCond %REQUEST_URI !^/events/index.html
RewriteCond %REQUEST_URI !^/calendar/index.html
Redirect 301 /info/faq.html http://mynewsite.com/my-page
Redirect 301 / http://mynewsite.com
apache .htaccess mod-rewrite redirect
add a comment |
I am trying to create an htaccess file to redirect my entire site except with some exceptions, but I can't get it working. I need to redirect the entire thing, provide a specific redirect, and exclude two pages. Below is my non-working sample. Thanks!
RewriteCond %REQUEST_URI !^/events/index.html
RewriteCond %REQUEST_URI !^/calendar/index.html
Redirect 301 /info/faq.html http://mynewsite.com/my-page
Redirect 301 / http://mynewsite.com
apache .htaccess mod-rewrite redirect
add a comment |
I am trying to create an htaccess file to redirect my entire site except with some exceptions, but I can't get it working. I need to redirect the entire thing, provide a specific redirect, and exclude two pages. Below is my non-working sample. Thanks!
RewriteCond %REQUEST_URI !^/events/index.html
RewriteCond %REQUEST_URI !^/calendar/index.html
Redirect 301 /info/faq.html http://mynewsite.com/my-page
Redirect 301 / http://mynewsite.com
apache .htaccess mod-rewrite redirect
I am trying to create an htaccess file to redirect my entire site except with some exceptions, but I can't get it working. I need to redirect the entire thing, provide a specific redirect, and exclude two pages. Below is my non-working sample. Thanks!
RewriteCond %REQUEST_URI !^/events/index.html
RewriteCond %REQUEST_URI !^/calendar/index.html
Redirect 301 /info/faq.html http://mynewsite.com/my-page
Redirect 301 / http://mynewsite.com
apache .htaccess mod-rewrite redirect
apache .htaccess mod-rewrite redirect
asked Jul 30 '10 at 14:19
VincentVincent
2011420
2011420
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
You're attempting to mix mod_rewrite with mod_alias, but the RewriteCond statements cannot condition the Redirect statements, as they don't come from the same module.
I believe you want something more like this, if I've correctly understood what you were trying to accomplish:
RewriteEngine On
RewriteCond %REQUEST_URI !=/events/index.html
RewriteCond %REQUEST_URI !=/calendar/index.html
RewriteCond %REQUEST_URI !=/info/faq.html
RewriteRule ^.*$ http://mynewsite.com/$0 [R=301,L]
Redirect 301 /info/faq.html http://mynewsite.com/my-page
I am trying to accomplish a variation of this - I want to redirect everything, unless the request is in to a specific directory (could be various file types) -- but it is not working: [code] RewriteEngine On RewriteCond %REQUEST_URI !=/sites/default/files/imports RewriteRule ^.*$ mynewsite.com/$0 [R=301,L] Redirect 301 / mynewsite.com [/code]
– Scott Szretter
Aug 9 '10 at 18:33
2
Try%REQUEST_URI !^/sites/default/files/imports, as the!=only works with exact string comparisons.
– Tim Stone
Aug 9 '10 at 22:09
add a comment |
I had a similar issue. Trying to redirect an entire domain with the exception of its robots.txt file. Tim's answer didn't work for me, but this did
RewriteEngine On
RewriteRule robots.txt - [L]
RewriteRule ^.*$ http://www.newsite.com/$0 [R=301,L]
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f3372344%2fhtaccess-301-redirect-entire-site-but-with-exceptions%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You're attempting to mix mod_rewrite with mod_alias, but the RewriteCond statements cannot condition the Redirect statements, as they don't come from the same module.
I believe you want something more like this, if I've correctly understood what you were trying to accomplish:
RewriteEngine On
RewriteCond %REQUEST_URI !=/events/index.html
RewriteCond %REQUEST_URI !=/calendar/index.html
RewriteCond %REQUEST_URI !=/info/faq.html
RewriteRule ^.*$ http://mynewsite.com/$0 [R=301,L]
Redirect 301 /info/faq.html http://mynewsite.com/my-page
I am trying to accomplish a variation of this - I want to redirect everything, unless the request is in to a specific directory (could be various file types) -- but it is not working: [code] RewriteEngine On RewriteCond %REQUEST_URI !=/sites/default/files/imports RewriteRule ^.*$ mynewsite.com/$0 [R=301,L] Redirect 301 / mynewsite.com [/code]
– Scott Szretter
Aug 9 '10 at 18:33
2
Try%REQUEST_URI !^/sites/default/files/imports, as the!=only works with exact string comparisons.
– Tim Stone
Aug 9 '10 at 22:09
add a comment |
You're attempting to mix mod_rewrite with mod_alias, but the RewriteCond statements cannot condition the Redirect statements, as they don't come from the same module.
I believe you want something more like this, if I've correctly understood what you were trying to accomplish:
RewriteEngine On
RewriteCond %REQUEST_URI !=/events/index.html
RewriteCond %REQUEST_URI !=/calendar/index.html
RewriteCond %REQUEST_URI !=/info/faq.html
RewriteRule ^.*$ http://mynewsite.com/$0 [R=301,L]
Redirect 301 /info/faq.html http://mynewsite.com/my-page
I am trying to accomplish a variation of this - I want to redirect everything, unless the request is in to a specific directory (could be various file types) -- but it is not working: [code] RewriteEngine On RewriteCond %REQUEST_URI !=/sites/default/files/imports RewriteRule ^.*$ mynewsite.com/$0 [R=301,L] Redirect 301 / mynewsite.com [/code]
– Scott Szretter
Aug 9 '10 at 18:33
2
Try%REQUEST_URI !^/sites/default/files/imports, as the!=only works with exact string comparisons.
– Tim Stone
Aug 9 '10 at 22:09
add a comment |
You're attempting to mix mod_rewrite with mod_alias, but the RewriteCond statements cannot condition the Redirect statements, as they don't come from the same module.
I believe you want something more like this, if I've correctly understood what you were trying to accomplish:
RewriteEngine On
RewriteCond %REQUEST_URI !=/events/index.html
RewriteCond %REQUEST_URI !=/calendar/index.html
RewriteCond %REQUEST_URI !=/info/faq.html
RewriteRule ^.*$ http://mynewsite.com/$0 [R=301,L]
Redirect 301 /info/faq.html http://mynewsite.com/my-page
You're attempting to mix mod_rewrite with mod_alias, but the RewriteCond statements cannot condition the Redirect statements, as they don't come from the same module.
I believe you want something more like this, if I've correctly understood what you were trying to accomplish:
RewriteEngine On
RewriteCond %REQUEST_URI !=/events/index.html
RewriteCond %REQUEST_URI !=/calendar/index.html
RewriteCond %REQUEST_URI !=/info/faq.html
RewriteRule ^.*$ http://mynewsite.com/$0 [R=301,L]
Redirect 301 /info/faq.html http://mynewsite.com/my-page
answered Jul 31 '10 at 6:06
Tim StoneTim Stone
18.2k65165
18.2k65165
I am trying to accomplish a variation of this - I want to redirect everything, unless the request is in to a specific directory (could be various file types) -- but it is not working: [code] RewriteEngine On RewriteCond %REQUEST_URI !=/sites/default/files/imports RewriteRule ^.*$ mynewsite.com/$0 [R=301,L] Redirect 301 / mynewsite.com [/code]
– Scott Szretter
Aug 9 '10 at 18:33
2
Try%REQUEST_URI !^/sites/default/files/imports, as the!=only works with exact string comparisons.
– Tim Stone
Aug 9 '10 at 22:09
add a comment |
I am trying to accomplish a variation of this - I want to redirect everything, unless the request is in to a specific directory (could be various file types) -- but it is not working: [code] RewriteEngine On RewriteCond %REQUEST_URI !=/sites/default/files/imports RewriteRule ^.*$ mynewsite.com/$0 [R=301,L] Redirect 301 / mynewsite.com [/code]
– Scott Szretter
Aug 9 '10 at 18:33
2
Try%REQUEST_URI !^/sites/default/files/imports, as the!=only works with exact string comparisons.
– Tim Stone
Aug 9 '10 at 22:09
I am trying to accomplish a variation of this - I want to redirect everything, unless the request is in to a specific directory (could be various file types) -- but it is not working: [code] RewriteEngine On RewriteCond %REQUEST_URI !=/sites/default/files/imports RewriteRule ^.*$ mynewsite.com/$0 [R=301,L] Redirect 301 / mynewsite.com [/code]
– Scott Szretter
Aug 9 '10 at 18:33
I am trying to accomplish a variation of this - I want to redirect everything, unless the request is in to a specific directory (could be various file types) -- but it is not working: [code] RewriteEngine On RewriteCond %REQUEST_URI !=/sites/default/files/imports RewriteRule ^.*$ mynewsite.com/$0 [R=301,L] Redirect 301 / mynewsite.com [/code]
– Scott Szretter
Aug 9 '10 at 18:33
2
2
Try
%REQUEST_URI !^/sites/default/files/imports, as the != only works with exact string comparisons.– Tim Stone
Aug 9 '10 at 22:09
Try
%REQUEST_URI !^/sites/default/files/imports, as the != only works with exact string comparisons.– Tim Stone
Aug 9 '10 at 22:09
add a comment |
I had a similar issue. Trying to redirect an entire domain with the exception of its robots.txt file. Tim's answer didn't work for me, but this did
RewriteEngine On
RewriteRule robots.txt - [L]
RewriteRule ^.*$ http://www.newsite.com/$0 [R=301,L]
add a comment |
I had a similar issue. Trying to redirect an entire domain with the exception of its robots.txt file. Tim's answer didn't work for me, but this did
RewriteEngine On
RewriteRule robots.txt - [L]
RewriteRule ^.*$ http://www.newsite.com/$0 [R=301,L]
add a comment |
I had a similar issue. Trying to redirect an entire domain with the exception of its robots.txt file. Tim's answer didn't work for me, but this did
RewriteEngine On
RewriteRule robots.txt - [L]
RewriteRule ^.*$ http://www.newsite.com/$0 [R=301,L]
I had a similar issue. Trying to redirect an entire domain with the exception of its robots.txt file. Tim's answer didn't work for me, but this did
RewriteEngine On
RewriteRule robots.txt - [L]
RewriteRule ^.*$ http://www.newsite.com/$0 [R=301,L]
answered Dec 10 '13 at 20:11
tomhoecktomhoeck
311
311
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f3372344%2fhtaccess-301-redirect-entire-site-but-with-exceptions%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown