Forum Moderators: phranque

Message Too Old, No Replies

Redirection not working

getting problem with redirection

         

YuviG

4:46 am on Jun 12, 2007 (gmt 0)

10+ Year Member



Hello friends

I have a problem with redirecting my domain from non-www to www. Now what is happening when i open my site without www it redirects to www.domain.com/public_html ... & shows 404 error ...

And i want to check MOD REWRITE is ON or not how can i check this ... where could i find httpd.conf file from my ftp?

Help me plzzzzzzz

Thanks

jdMorgan

2:30 pm on Jun 12, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



We can't really discuss a code problem very effectively without seeing the code (with all real domains removed, please)...

To test mod_rewrite, do something like:


RewriteRule ^fake-page\.html$ http://www.webmasterworld.com [R=301,L]

If you request "/fake-page.html" from your server, and end up at WebmasterWorld, then the rule worked.

[added] If you're on shared commercial hosting, it is unlikely that you'll have access to httpd.conf from FTP [/added]

Jim

[edited by: jdMorgan at 2:32 pm (utc) on June 12, 2007]

YuviG

4:29 am on Jun 13, 2007 (gmt 0)

10+ Year Member



Thanks for your concern ...

this is the code i hv in .htaccess

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^example.com [nc]
rewriterule ^(.*)$ http://www.example.com/$1 [r=301,nc]

i have following folders in my ftp
.filter
.gnupg
.panel
.vmailmgr
public_ftp
public_html

Where to fild httpd.conf and tell me more where to place .htaccess file.

Thanks a lot.

[edited by: jdMorgan at 4:57 am (utc) on June 13, 2007]
[edit reason] example.com [/edit]

jdMorgan

4:55 am on Jun 13, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Place this in /public_html/.htaccess:

Options +FollowSymLinks
RewriteEngine on
#
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

Ask your host if you have access to httpd.conf. If this is a shared name-based server, you probably do not have access to httpd.conf.

Jim

YuviG

6:02 am on Jun 13, 2007 (gmt 0)

10+ Year Member



Thanks a lot buddy ... its done.