redirect www.xyz.com to xyz.com and the other way around

Hi,

is there a way to redirect any url of the form www.xyz.com/any_folder/anyfile.php?parameter=any_parameter

to
xyz.com/any_folder/anyfile.php?parameter=any_parameter

?
And is the xyz.com/..... option compatible with all browsers?

Regards,
G
expertsgerritAsked:
Who is Participating?
 
l4ncel0tConnect With a Mentor Commented:
In your apache config
If you have virtualhost in the virtualhost definition
if not in the main apache config file
eg
/etc/apache2/site-avaiable/apache2.conf
0
 
l4ncel0tCommented:
no problem

        RewriteEngine On
        RewriteCond %{HTTP_HOST} www\.xyz\.com
        RewriteRule ^/(.*)$ https://xyz.com/$1 [L,R=301]


This should work
0
 
expertsgerritAuthor Commented:
where should I put this?
any file that gets visited
some header file?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.