tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier (tomcat) ...@ice-sa.com>
Subject Re: non www to www URL Rewrite
Date Wed, 08 Nov 2017 17:20:06 GMT
On 08.11.2017 17:35, RAVIRAJ SHAH wrote:
> Sorry for my language
> my query with example
>
> Let's say my website domain is "example.com"
> Now I want to redirect "example.com" to "www.example.com"
> Kindly share how I can achieve it

Well first, you need the 2 entries in the DNS server for "example.com".
You need :
example.com --> public Internet IP address of your server (A)
www.example.com --> public  Internet IP address of your server (B)

and A == B

otherwise it will never work.
Do you have that ?

You can check this by getting a command-line window somewhere and entering :
nslookup example.com
nslookup www.example.com
and both should give the same IP address.



>
> On Wed, Nov 8, 2017, 19:08 André Warnier (tomcat) <aw@ice-sa.com> wrote:
>
>> On 08.11.2017 14:30, RAVIRAJ SHAH wrote:
>>> Anybody please help
>>
>> I think that you first try to communicate more clearly what you want to
>> achieve.
>> "redirect non-www URL to www URL only"
>> does not appear to make much sense.
>>
>> Also please send your message to the list as *plain text*, not html.
>> It will make it easier to read configuration lines below which look like
>> URL's.
>>
>>
>>>
>>> On Tue, Nov 7, 2017, 12:00 RAVIRAJ SHAH <me.raviraj007@gmail.com> wrote:
>>>
>>>> Dear All,
>>>>
>>>> Kindly request you to help to resolve this issue
>>>>
>>>> Problem Statement :
>>>> we want to redirect non-www URL to www URL only
>>>>
>>>> Current setup :
>>>>
>>>> Defined rewrite valve in server.xml as below
>>>>
>>>>
>>>> <Host name="thevgr.com" appBase="webapps" unpackWARs="true" autoDeploy=
>>>> "true">
>>>>
>>>>
>>>>
>>>>       <Valve className="org.apache.catalina.valves.rewrite.RewriteValve"
>> />
>>>>
>>>>
>>>>
>>>> </Host>
>>>>
>>>> Created rewrite.config file in ../conf/Catalina/<Hostname>/
>>>>
>>>>
>>>> *RewriteCond %{HTTP_HOST} !^(.*)\.yourdomain\.com$ [NC] RewriteRule
>> ^(.*)$
>>>> http://www.yourdomain.com <http://www.yourdomain.com>/$1 [R=301,L]*
>>>>
>>>> *kindly do needful*
>>>>
>>>> Thanks & Regards,
>>>> Raviraj Shah
>>>>
>>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message