Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6157633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:49:08+00:00 2026-05-23T20:49:08+00:00

I asked the same question Redirect to site if WWW part is missing but

  • 0

I asked the same question Redirect to site if WWW part is missing but the answer did not helped in my case, as i was unable to get to change the CNAME and .htaccess also failed.
The only option left is to use PHP.
Can anyone help me ?

If someone tries to browse example.com or example.com/ or so the PHP will redirect it to http://www.example.com/..

edit

SetEnv TZ Asia/Calcutta 

ErrorDocument 400 /error.html
ErrorDocument 401 /error.html
ErrorDocument 403 /error.html
ErrorDocument 404 /error.html

<ifModule mod_php4.c>
 php_value zlib.output_compression 16386
</ifModule>

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /

RewriteRule ^home$ home.php [L]

RewriteRule ^credit$ credits.php [L]
RewriteRule ^credits$ credits.php [L]

RewriteRule ^profile/(\d+)/?$ profile.php?id=$1 [L]
RewriteRule ^user/(\d+)/?$ view_profile.php?id=$1 [L]

RewriteRule ^blog/?$ blog.php [L]
RewriteRule ^blog/(\d+)/?$ blog.php?id=$1 [L]
RewriteRule ^blog.php/(\d+)/?$ blog.php?id=$1 [L]
RewriteRule ^blog/(\d+)/([A-Za-z0-9-_\[\]]+)/?$ blog.php?id=$1&title=$2 [L]
RewriteRule ^blog.php/(\d+)/([A-Za-z0-9-_\[\]]+)/?$ blog.php?id=$1&title=$2 [L]

RewriteRule ^blogbyauthor.php/(\d+)/?$ blogbyauthor.php?uid=$1 [L]
RewriteRule ^blogbyauthor/(\d+)/?$ blogbyauthor.php?uid=$1 [L]
RewriteRule ^blogbyauthor/(\d+)/?$ blogbyauthor.php?uid=$1 [L]

RewriteRule ^blog_by_category.php/([A-Za-z0-9-_\[\]]+)/?$ blog_by_category.php?category=$1 [L]
RewriteRule ^blog_by_category/([A-Za-z0-9-_\[\]]+)/?$ blog_by_category.php?category=$1 [L]
</IfModule>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T20:49:09+00:00Added an answer on May 23, 2026 at 8:49 pm

    Try this in .htaccess:

    <IfModule mod_rewrite.c>
        Options +FollowSymlinks
        RewriteEngine on
    
        # site.com -> www.site.com
        RewriteCond %{HTTP_HOST} ^site.com
        RewriteRule ^(.*)$ http://www.site.com/$1 [R=301,L]
    
    </IfModule>
    

    Obviously you should change site.com with your domain.


    Update: incorporated your code with my suggestion.

    SetEnv TZ Asia/Calcutta 
    
    ErrorDocument 400 /error.html
    ErrorDocument 401 /error.html
    ErrorDocument 403 /error.html
    ErrorDocument 404 /error.html
    
    <ifModule mod_php4.c>
     php_value zlib.output_compression 16386
    </ifModule>
    
    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteBase /
    
    # site.com -> www.site.com
    RewriteCond %{HTTP_HOST} ^site.com
    RewriteRule ^(.*)$ http://www.site.com/$1 [R=301,L]
    
    RewriteRule ^home$ home.php [L]
    
    RewriteRule ^credit$ credits.php [L]
    RewriteRule ^credits$ credits.php [L]
    
    RewriteRule ^profile/(\d+)/?$ profile.php?id=$1 [L]
    RewriteRule ^user/(\d+)/?$ view_profile.php?id=$1 [L]
    
    RewriteRule ^blog/?$ blog.php [L]
    RewriteRule ^blog/(\d+)/?$ blog.php?id=$1 [L]
    RewriteRule ^blog.php/(\d+)/?$ blog.php?id=$1 [L]
    RewriteRule ^blog/(\d+)/([A-Za-z0-9-_\[\]]+)/?$ blog.php?id=$1&title=$2 [L]
    RewriteRule ^blog.php/(\d+)/([A-Za-z0-9-_\[\]]+)/?$ blog.php?id=$1&title=$2 [L]
    
    RewriteRule ^blogbyauthor.php/(\d+)/?$ blogbyauthor.php?uid=$1 [L]
    RewriteRule ^blogbyauthor/(\d+)/?$ blogbyauthor.php?uid=$1 [L]
    RewriteRule ^blogbyauthor/(\d+)/?$ blogbyauthor.php?uid=$1 [L]
    
    RewriteRule ^blog_by_category.php/([A-Za-z0-9-_\[\]]+)/?$ blog_by_category.php?category=$1 [L]
    RewriteRule ^blog_by_category/([A-Za-z0-9-_\[\]]+)/?$ blog_by_category.php?category=$1 [L]
    </IfModule>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have asked the same question before, but did not get what I want.
I asked the same question yesterday and the answer was not applicable. https://stackoverflow.com/questions/6194578/breaking-up-class-functions-into-multiple-cpp-files If
Asked the same question here but got no answer, so I'm trying here instead
This is driving me nuts. I believe I asked this exact same question, but
I've asked the same question some days ago, but there I wanted to solve
I know many have asked the same question but I am still confused that
I had asked the same question for iOS on iPad but now I am
I have asked the same question for some days on oracle forums, but no
I asked this same question on javaprogrammingforums.com but it seems their website is down
I've asked the same question before for Flex, but due to some restrictions, I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.