Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] .htaccess redirect from https to http shows the "index.php?"
#6

[eluser]Joakim_[/eluser]
[quote author="PowerCode" date="1230634122"]Oops, I'm really sorry. You actually need the index.php or index.php? (as required by some hosts). So your previous query was right. That's the reason for the internal server error. So you need to change it back to RewriteRule ^(.*)$ /index.php?/$1. My bad.

Just make sure you've set $config['index_page'] I mentioned above to "", though it may not be the problem.

Anyways, I just did a small test,

Code:
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1

RewriteCond %{REQUEST_URI} (auth)
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301]

I had this in a folder called HTTPS, and thus tried http://localhost/HTTPS/auth, which matched the second condition. Now instead of redirecting to https://localhost/HTTPS/auth, it redirects to https://localhost/HTTPS/auth?/auth. I don't know what the problem is Sad.[/quote]

Thank you very much for all your help!

The strange thing is that it used to work when I had the CI installation in a folder like /ci/. When I moved it to root and combined the .htaccess files from root and /ci/ it didn't work no more. Before, the .htaccess code to remove the index.php? was in a separate .htaccess file in the /ci/ directory and the rest was in the root .htaccess file.

Like this:

/.htaccess (root)

Code:
RewriteEngine On

RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} (auth)
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301]

RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !(auth)
RewriteRule ^(.*)$ http://%{SERVER_NAME}%{REQUEST_URI} [R=301]

/ci/.htaccess

Code:
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /ci/index.php?/$1


Thanks! Smile


Messages In This Thread
[SOLVED] .htaccess redirect from https to http shows the "index.php?" - by El Forum - 12-30-2008, 06:21 AM



Theme © iAndrew 2016 - Forum software by © MyBB