LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > General > htaccess redirect help

Reply
 
Thread Tools Display Modes
  #1  
Old 09-11-2011, 09:54 PM
atomicmak atomicmak is offline
Member
 
Join Date: Sep 2011
Posts: 11
Default htaccess redirect help

need to redirect url from http://mydomain.tld to http://www.mydomain.tld

i have wrote
RewriteCond %{HTTP_HOST} ^wildart.in [NC]
RewriteRule ^(.*)$ http://www.wildart.in/$1 [R=301,L]

in my htaccess and still it cant redirect

i am using hawkhost shared hosting.

please help.
Reply With Quote
  #2  
Old 09-11-2011, 10:04 PM
NiteWave NiteWave is online now
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,218
the grammar looks ok.
but http://wildart.in is served by cloudflare-nginx ? not litespeed
Reply With Quote
  #3  
Old 09-11-2011, 10:06 PM
atomicmak atomicmak is offline
Member
 
Join Date: Sep 2011
Posts: 11
well yeah i use cloudflare service. does it make any differ as i thought it would just be a caching server for images.
Reply With Quote
  #4  
Old 09-11-2011, 10:07 PM
atomicmak atomicmak is offline
Member
 
Join Date: Sep 2011
Posts: 11
here is the entire htaccess as i have many other rules which are working though i still using cloudflare.

====================

# htaccess file version 1.4.1;
# When Zenphoto requires changes to the rewrite rules:
# First make a copy of this file as 'oldhtaccess' in the zp-core folder so setup can test for unmodified files
# Update the above and the define in setup.php


<IfModule mod_rewrite.c>
RewriteEngine On

RewriteBase /

RewriteRule ^admin/?$ zp-core/admin.php [R,L]

RewriteCond &#37;{REQUEST_FILENAME} -d
RewriteRule ^albums/?(.+/?)?$ $1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [L]

##### put no rules before this line #######

#######################
#Rewrite rules for removed sitemap.php
RewriteRule ^sitemap\.php index.php?sitemap [L,R=301]

#Rewrite rules for removed RSS files
RewriteCond %{QUERY_STRING} albumtitle=(.*)&albumname=(.*)&lang=".$lang
RewriteRule ^rss\.php/?$ index.php?rss&albumtitle=%1&albumname=%2&lang=%3 [L,R=301]

RewriteCond %{QUERY_STRING} albumtitle=(.*)&folder=(.*)&lang=(.*)
RewriteRule ^rss\.php/?$ index.php?rss&albumtitle=%1&folder=%2&lang=%3 [L,R=301]

RewriteCond %{QUERY_STRING} albumtitle=(.*)&albumname=(.*)&lang=(.*)
RewriteRule ^rss\.php/?$ index.php?rss&albumtitle=%1&albumname=%2&lang=%3 [L,R=301]

RewriteCond %{QUERY_STRING} folder=(.*)&lang=(.*)&albumsmode
RewriteRule ^rss\.php/?$ index.php?rss&folder%1&lang=%2&albumsmode [L,R=301]

RewriteCond %{QUERY_STRING} withimages&lang=(.*)
RewriteRule ^rss-news\.php/?$ index.php?rss-news&withimages&lang=%1 [L,R=301]

RewriteCond %{QUERY_STRING} id=(.*)&title=(.*)&type=(.*)&lang=(.*)
RewriteRule ^rss-comments\.php/?$ index.php?rss-comments&id=%1&title=%2&type=%3&lang=%4 [L,R=301]

RewriteCond %{QUERY_STRING} type=(.*)&lang=(.*)
RewriteRule ^rss-comments\.php/?$ index.php?rss-comments&type=%1&lang=%2 [L,R=301]

RewriteCond %{QUERY_STRING} lang=(.*)&albumsmode
RewriteRule ^rss\.php/?$ index.php?rss&lang=%1&albumsmode [L,R=301]

RewriteCond %{QUERY_STRING} lang=(.*)&category=(.*)
RewriteRule ^rss-news\.php/?$ index.php?rss-news&lang=%1&category=%2 [L,R=301]

RewriteCond %{QUERY_STRING} lang=(.*)
RewriteRule ^rss\.php/?$ index.php?rss&lang=%1 [L,R=301]
RewriteRule ^rss-news\.php/?$ index.php?rss-news&lang=%1 [L,R=301]
#######################
#rewrite rule for tinyURLs
RewriteRule ^tiny/([0-9]+)/?$ index.php?p=$1&t [L,QSA]

RewriteRule index\.php$ index.php [L,QSA]
RewriteRule ^page/([0-9]+)/?$ index.php?page=$1 [L,QSA]
RewriteRule ^page/([A-Za-z0-9_\-]+)/?$ index.php?p=$1 [L,QSA]
RewriteRule ^page/([A-Za-z0-9_\-]+)/([0-9]+)/?$ index.php?p=$1&page=$2 [L,QSA]
RewriteRule ^(.*)/page/([0-9]+)/?$ index.php?album=$1&page=$2 [L,QSA]
RewriteRule ^(.*)/page/([A-Za-z0-9_\-]+)/?$ index.php?album=$1&p=$2 [L,QSA]

#### Rewrite rule addition for search
RewriteRule ^page/search/fields([0-9]+)/(.*)/([0-9]+)/?$ index.php?p=search&searchfields=$1&words=$2&page=$ 3 [L,QSA]
RewriteRule ^page/search/fields([0-9]+)/(.*)/?$ index.php?p=search&searchfields=$1&words=$2 [L,QSA]
RewriteRule ^page/search/archive/(.*)/([0-9]+)/?$ index.php?p=search&date=$1&page=$2 [L,QSA]
RewriteRule ^page/search/archive/(.*)/?$ index.php?p=search&date=$1 [L,QSA]
RewriteRule ^page/search/tags/(.*)/([0-9]+)/?$ index.php?p=search&searchfields=tags&words=$1&page =$2 [L,QSA]
RewriteRule ^page/search/tags/(.*)/?$ index.php?p=search&searchfields=tags&words=$1 [L,QSA]
RewriteRule ^page/search/(.*)/([0-9]+)/?$ index.php?p=search&words=$1&page=$2 [L,QSA]
RewriteRule ^page/search/(.*)/?$ index.php?p=search&words=$1 [L,QSA]
#### Rewrite additions for zenpage
RewriteRule ^pages/?$ index.php?p=pages [L,QSA]
RewriteRule ^pages/(.*)/?$ index.php?p=pages&title=$1 [L,QSA]
RewriteRule ^news/?$ index.php?p=news [L,QSA]
RewriteRule ^news/([0-9]+)/?$ index.php?p=news&page=$1 [L,QSA]
RewriteRule ^news/category/(.*)/([0-9]+)/?$ index.php?p=news&category=$1&page=$2 [L,QSA]
RewriteRule ^news/category/(.*)/?$ index.php?p=news&category=$1 [L,QSA]
RewriteRule ^news/archive/(.*)/([0-9]+)/?$ index.php?p=news&date=$1&page=$2 [L,QSA]
RewriteRule ^news/archive/(.*)/?$ index.php?p=news&date=$1 [L,QSA]
RewriteRule ^news/(.*)/?$ index.php?p=news&title=$1 [L,QSA]
####
RewriteRule ^(.*)/image/(thumb|[0-9]{1,4})/([^/\\]+)$ zp-core/i.php?a=$1&i=$3&s=$2 [L,QSA]
RewriteRule ^(.*)/image/([^/\\]+)$ zp-core/i.php?a=$1&i=$2 [L,QSA]
RewriteRule ^(.*)/album/(thumb|[0-9]{1,4})/([^/\\]+)$ zp-core/i.php?a=$1&i=$3&s=$2&album=true [L,QSA]
####

# Catch-all - everything else gets handled in PHP for compatibility.
RewriteRule ^(.*)/?$ index.php?album=$1 [L,QSA]

#WWW redirect

RewriteCond %{HTTP_HOST} !^www.wildart\.in$
RewriteRule ^/(.*)$ http://www.wildart.in/$1 [R=301,L]

</IfModule>AddHandler application/x-httpd-php53 php

==================================
Reply With Quote
  #5  
Old 09-11-2011, 10:10 PM
atomicmak atomicmak is offline
Member
 
Join Date: Sep 2011
Posts: 11
I also wanted to add one more new feature which it seems not working

say i have url

http://www.wildart.in/Gulls
and
http://www.wildart.in/Gulls/Laughing_gull

WHich i wanted to convert to

http://www.wildart.in/gulls
and
http://www.wildart.in/gulls/laughing_gull

likewise for all albums and subalbums on my site for seo through rewrite
Reply With Quote
  #6  
Old 09-11-2011, 10:11 PM
NiteWave NiteWave is online now
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,218
got it -- move the 2 lines to the very beginning, should work fine.
Reply With Quote
  #7  
Old 09-11-2011, 10:13 PM
atomicmak atomicmak is offline
Member
 
Join Date: Sep 2011
Posts: 11
you mean after RewriteEngine On ?
Reply With Quote
  #8  
Old 09-11-2011, 10:15 PM
NiteWave NiteWave is online now
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,218
yes. the order of rules is important.
Reply With Quote
  #9  
Old 09-11-2011, 10:16 PM
atomicmak atomicmak is offline
Member
 
Join Date: Sep 2011
Posts: 11
i did like this but it still not working

<IfModule mod_rewrite.c>
RewriteEngine On
#WWW redirect

RewriteCond %{HTTP_HOST} !^www.wildart\.in$
RewriteRule ^/(.*)$ http://www.wildart.in/$1 [R=301,L]

RewriteBase /

RewriteRule ^admin/?$ zp-core/admin.php [R,L]

RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^albums/?(.+/?)?$ $1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [L]

##### put no rules before this line #######
Reply With Quote
  #10  
Old 09-11-2011, 10:20 PM
NiteWave NiteWave is online now
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,218
should remove a "/".
try:
RewriteCond %{HTTP_HOST} !^www\.wildart\.in$
RewriteRule ^(.*)$ http://www.wildart.in/$1 [R=301,L]
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 09:03 PM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.