Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7408969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:00:11+00:00 2026-05-29T06:00:11+00:00

Below is the whole htaccess file. It should (and works fine for everything except

  • 0

Below is the whole htaccess file.

It should (and works fine for everything except administration folder):

  • add www. to the URL typed (but not for administration folder, just leave it),
  • hide index.php from the URL typed (but not for administration folder, just leave it),
  • replace http with https, or https with http depending on the URL typed (but not for administration folder, because administration folder should always be https)

Unfortunately, with the .htaccess file below, both http:// (and https://) www.mydomain.com/administartion/index.php go to 404 error page. How to fix?

So, #block0, #block1, #block2 in .htaccess work fine, they make their work (URLs to administration folder are always https, no redirections to 404 page)

Also, #block0, #block3 – #block8 make their work (works fine for any URLs that is not to administration folder)

But, once I put them all together (add #block3 – #block8 right after #block0-#block2), then http://www.mydomain.com/administartion/index.php starts going to 404 page.

What’s the reason and how to fix?
Thank you.

#block0
RewriteEngine On

#block1
#special rules for administration folder, http to https, if http
RewriteCond %{REQUEST_URI} ^/administration
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R,L=301]

#block2
RewriteCond %{REQUEST_URI} ^/administration
RewriteRule ^administration - [NC,L]
#URLs to administration folder should be stopped before this line.




#block3
RewriteCond %{HTTP_HOST} !^www.mydomain.com$
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,L]

#block4
RewriteCond %{REQUEST_METHOD} !POST
RewriteRule ^index.php / [L,R=301]



#block5
#if its a resource (add others that are missing)
RewriteCond %{REQUEST_URI} \.(gif|css|png|js|jpe?g)$ [NC]
#do nothing
RewriteRule ^ - [L]

#block6
#determine if page is supposed to be http
RewriteCond %{QUERY_STRING} (^|&)(p=home1?|qqq=home)(&|$) [NC,OR]
#or if query string is empty
RewriteCond %{QUERY_STRING} ^$
#set env var to 1
RewriteRule ^ - [E=IS_HTTP:1]

#block7
#all pages that are supposed to be http redirected if https
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{HTTPS} on
RewriteCond %{ENV:IS_HTTP} 1
RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [R,L=301]

#block8
#all other pages are sent to https if not already so
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{HTTPS} off
RewriteCond %{ENV:IS_HTTP} !1
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R,L=301]
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T06:00:11+00:00Added an answer on May 29, 2026 at 6:00 am

    change [R,L=301] should be [R=301,L] in #block1 #block7 #block8

    Also setup a certificate to https and do you have a VirtualHost *:443 in your .conf of apache?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble with some URL rewriting. All of the stuff below works fine,
The uncommented code below yields an OperationalError: near? while the commented lines works fine.
svn info for the whole codebase (not a particular file) gives me below output.
I followed below tutorial and built one whole complete app. http://www.tonyamoyal.com/2010/07/28/rails-authentication-with-devise-and-cancan-customizing-devise-controllers/ http://www.tonyamoyal.com/2010/09/29/rails-authentication-with-devise-and-cancan-part-2-restful-resources-for-administrators/comment-page-2/#comment-879 All is
these below codes give whole data of my Rehber datas. But if i want
webview in android loads more than once while loading the url. Below is the
the whole data operation is below. i want to close close each and every
The code below helps be to get the WHOLE XML and put it into
I'am using the below code to copy paste..but it doesnt copy the whole context
How can I set the cache expiry date of a whole folder of images

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.