It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming HTML Forum

Rewrite from https to http? HELP!!!!

Rewrite from https to http? HELP!!!!

Postby martinos on Tue Mar 16, 2010 6:26 pm

Hello

I have met a problem with the rewrite of my .Htaccess.

Now i have my entire site to be rewrite'ed from http://www.mysite.com to https://secure.mysite.com
and it's encoded in my .htaccess:

[code] Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^secure.mysite.com [NC]
RewriteRule ^(.*)$ https://secure.mysite.com/$1 [L,R=301] [/ code]

In this way, every single page redirected to my secure server at https://secure.mysite.com
It works very well and so it shall remain.


but there is a single page, which I do not want to become rewrite'ed,
eg I do not want to http://www.mysite.com/page1.php be rewriteed to https://secure.mysite.com/page1.php
it is the only urI do not want it to rewrite,

what should I add more to the code I have currently?

I hope you could help .. :)
ps. I am not an expert so I may like to write what to add to my code: wink:

Sincerely, Martin
martinos
 
Posts: 5
Joined: Tue Mar 16, 2010 6:25 pm

Re: Rewrite from https to http? HELP!!!!

Postby webmaster on Tue Mar 16, 2010 8:31 pm

Hi Martin and welcome to DEVPPL!

What you need to do in this case is to set a rule for that specific file BEFORE the other rule in your .htaccess

I'm not sure how the rule should work, maybe you can just add this one:
Code: Select all
RewriteRule ^page1.php/?$ /page1.php [L]
User avatar
webmaster
Site Admin
 
Posts: 2695
Joined: Tue Aug 17, 2004 1:07 pm
Location: Sweden

Re: Rewrite from https to http? HELP!!!!

Postby martinos on Tue Mar 16, 2010 8:51 pm

thanks "webmaster". and thanks for reply (:

i dont work i go an HTTP Error 404

i put it like this: then i got 404 error

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^getip.php/?$ /getip.php [L]
RewriteCond %{HTTP_HOST} !^secure.mysite.com [NC]
RewriteRule ^(.*)$ https://secure.mysite.com/$1 [L,R=301]

hmm another solution maybe? :/
Last edited by martinos on Tue Mar 16, 2010 9:04 pm, edited 1 time in total.
martinos
 
Posts: 5
Joined: Tue Mar 16, 2010 6:25 pm

Re: Rewrite from https to http? HELP!!!!

Postby webmaster on Tue Mar 16, 2010 9:00 pm

Howabout this one
Code: Select all
RewriteRule ^getip1.php/?$ /getip.php [L]


And then try to visit the: getip1.php -page?
User avatar
webmaster
Site Admin
 
Posts: 2695
Joined: Tue Aug 17, 2004 1:07 pm
Location: Sweden

Re: Rewrite from https to http? HELP!!!!

Postby martinos on Tue Mar 16, 2010 9:10 pm

thanks again webmaster

it dont work :/

you can try, it dont work.
https://secure.domain.com/getip.php
https://secure.domain.com/getip1.php

it is becouse i got wrong ip adresse on getip.php becouse it's on https and not http, becouse that i want it to http://domain.com/getip.php or http://www.domain.com/getip.php

i put the code like what you told me:
RewriteRule ^getip1.php/?$ /getip.php [L]

thanks (:
Last edited by martinos on Tue Mar 16, 2010 9:34 pm, edited 1 time in total.
martinos
 
Posts: 5
Joined: Tue Mar 16, 2010 6:25 pm

Re: Rewrite from https to http? HELP!!!!

Postby webmaster on Tue Mar 16, 2010 9:24 pm

It's strange that http://www.domain.com/file.php gets redirected to https://secure.domains.com/file.php with that.htaccess..

Is that the whole .htaccess you got?
User avatar
webmaster
Site Admin
 
Posts: 2695
Joined: Tue Aug 17, 2004 1:07 pm
Location: Sweden

Re: Rewrite from https to http? HELP!!!!

Postby martinos on Tue Mar 16, 2010 9:32 pm

hello

all pages in my homepage will be redirected to https://secure.domain.com, becouse i used that code:
Code: Select all
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^secure.domain.com [NC]
RewriteRule ^(.*)$ https://secure.domain.com/$1 [L,R=301]


i just added you code you gave me like that:
Now in my .htaccess:

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^getip1.php/?$ /getip.php [L]
RewriteCond %{HTTP_HOST} !^secure.domain.com [NC]
RewriteRule ^(.*)$ https://secure.domain.com/$1 [L,R=301]


that is what you asked me?
thanks :)
martinos
 
Posts: 5
Joined: Tue Mar 16, 2010 6:25 pm

Re: Rewrite from https to http? HELP!!!!

Postby martinos on Tue Mar 16, 2010 9:38 pm

martinos
 
Posts: 5
Joined: Tue Mar 16, 2010 6:25 pm


Who is online

Users browsing this forum: No registered users and 5 guests