.htaccess Redirect Works for One but Not Other Folder Requests.

I have a Website that is using Angular and a Single Page Application. It is called "Making Your Life Count".

In the upper right you see the nav bar. If you click the "about" it takes you to the correct page and if you click "devos" it takes you to the desired page.

If you mouse over the menu link, it give you the URL of "https://makingyourlifecount.net/#/about

I have the .htaccess file working so that the url of "https://makingyourlifecount.net/about" takes you to the about page.

But for some reason when you try to go to: "https://makingyourlifecount.net/devos" it gives me this warning:

400 Bad Request
The plain HTTP request was sent to HTTPS port

It also changes the URL to: http://makingyourlifecount.net:443/#/devos

I can't figure out why it is doing that...

With the angular js router, I am using the following .htaccess file.

#HTTPS rewrite entire site
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
RewriteCond %{HTTP_HOST} ^www.makingyourlifecount.net [NC]
RewriteRule ^(.*)$ http://makingyourlifecount.net/$1 [L,R=301]
RewriteRule ^index.html$ /index.php [R,L]

# 301 Redirect Old File
Redirect 301 /resources.html https://makingyourlifecount.net/#/resources
Redirect 301 /resources https://makingyourlifecount.net/#/resources
Redirect 301 /about https://makingyourlifecount.net/#/about
Redirect 301 /devos https://makingyourlifecount.net/#/devos

Redirect 301 /youversion https://makingyourlifecount.org/#/message/youversion
Redirect 301 /how https://makingyourlifecount.org/#/message/hwdng
Redirect 301 /ebook https://makingyourlifecount.org/#/message/ebook
Redirect 301 /cnn http://www.cnn.com

Open in new window

My desired results is that both https://makingyourlifecount.net/about and https://makingyourlifecount.net/devos URLs both respectively redirect to the correct page like the menu does.

If have spent a long time trying different things, but cannot get it to work. Any help would be appreciated. Thanks.

Paul KonstanskiProject SpecialistAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David S.Commented:
Are you sure there aren't additional redirects in another file? I'm not seeing anything that indicates why one would work but not the other. What directories (just the 1st level) are in the web root (often called "public_html") directory?

P.S. Are you sure that you want URLs that all just go to the home page when JS support is unavailable (for whatever reason)?
Paul KonstanskiProject SpecialistAuthor Commented:
For security I can't reveal all of the directories... but the ones that can publically be seen (which amounts to the majority) are:


If you are not seeing anything obvious, then what I may do is create an additional menu item called "devo2" and then build it one step at a time until it fails..

Regarding non-JS support... this whole site crashes without JS support, so maybe someday when I have spare time, I'll put in a non-JS mode that will accommodate the small small percentage of people without JS support. But thanks for reminding me. I will update this if I see something.

UPDATE: I added a menu item called "DAVOS" -- it is an exact copy of "DEVOS" and it works fine.  As best as I've been able to test, this URL takes me right to the desired llocation:

I then also did this test... I got rid of all of the extra files and just left the redirect in the .htaccess file  === it still worked.

So the issue has to be something hidden somewhere that I'm not seeing. I'm about to move this while site to a faster server, so we'll just see if the problem disappears in the move. I'll move one step at a time so I can see where the problem occurs.

I will leave this open for a bit in case anybody else wants to weigh in.\

I also created a .htaccess redirect for
RobOwner (Aidellio)Commented:
You mention you're using Angular routing as well.  What routes have you specified in Angular?
Paul KonstanskiProject SpecialistAuthor Commented:
Rob, thanks for the question.  

All is working fine today. So what I believe happened is it was a cache issue on the server. So right now I'm all set.

But in answer to your question, here is the Route Provider:

    function configuration($routeProvider) {
            .when("/", {
                templateUrl: "partials/home.html"
            .when("/about", {
                templateUrl: "partials/about.html",
            .when("/devos", {
                templateUrl: "partials/devos.html"
            .when("/resources", {
                templateUrl: "partials/resources.html"
            .when("/message/:type", {
                templateUrl: "partials/message.html",
                controller: "MessageController",
                controllerAs: "model"
            .when("/support", {
                templateUrl: "partials/support.html"
                redirectTo: "/"

Open in new window

RobOwner (Aidellio)Commented:
That's good to hear.  Wonder if the server rebooted? I've found apache needs a restart to effectively reapply the .htaccess routing but whatever... glad it's working :)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.