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;








5















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









share|improve this question




























    5















    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









    share|improve this question
























      5












      5








      5








      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









      share|improve this question














      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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jul 30 '10 at 14:19









      VincentVincent

      2011420




      2011420






















          2 Answers
          2






          active

          oldest

          votes


















          16














          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





          share|improve this answer























          • 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



















          3














          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]





          share|improve this answer























            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
            );



            );













            draft saved

            draft discarded


















            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









            16














            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





            share|improve this answer























            • 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
















            16














            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





            share|improve this answer























            • 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














            16












            16








            16







            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





            share|improve this answer













            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






            share|improve this answer












            share|improve this answer



            share|improve this answer










            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


















            • 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














            3














            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]





            share|improve this answer



























              3














              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]





              share|improve this answer

























                3












                3








                3







                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]





                share|improve this answer













                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]






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Dec 10 '13 at 20:11









                tomhoecktomhoeck

                311




                311



























                    draft saved

                    draft discarded
















































                    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.




                    draft saved


                    draft discarded














                    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





















































                    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







                    Popular posts from this blog

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

                    155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해