• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 324
  • Last Modified:

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
0
expertsgerrit
Asked:
expertsgerrit
  • 2
1 Solution
 
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
 
l4ncel0tCommented:
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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now