Forum Moderators: phranque

Message Too Old, No Replies

Need help redirecting in Apache

         

trinorthlighting

9:48 pm on Jan 4, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I need some apache coding help myself.
I need to redirect this url

[mysite.com...]

to

[mysite.com...]

Currenly my htaccess looks like this:

Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP_HOST}//s%{HTTPS} ^www\.(.*)//((s)on¦s.*)$ [NC]
RewriteRule ^ http%3://%1%{REQUEST_URI} [L,R=301]

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ [mysite.com...] [R=301,L]

Currently we have the www redirected to the non www which we like. We also have [mysite.com...] redirecting as well.

Just can not figure out how to redirect

[mysite.com...]

to

[mysite.com...]

Can anyone help me?

jdMorgan

12:58 am on Jan 5, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This should do it:
[code]
Options +FollowSymlinks
RewriteEngine on
#
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php(\?(main_page=index)?)?\ HTTP/
RewriteRule ^index\.php$ [mysite.com...] [R=301,L]
#
RewriteCond %{HTTP_HOST}<>s%{HTTPS} ^www\.([^<]+)<>((s)on¦s.*)$ [NC]
RewriteRule ^ http%3://%1%{REQUEST_URI} [R=301,L]
[code]
Removed redundant Options and RewriteEngine directives
Improved efficiency/speed of first rule pattern-matching
Accept optional "main_page=index" or blank query string as match in redirect to "/"
Added "?" to substitution URL to clear query string on redirect
Reversed rules to avoid stacked redirects

Jim

trinorthlighting

1:26 am on Jan 5, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thank you very much, that worked very good.