Keep or delete www when saving URLs?

I am creating a PHP5 application that needs to save a unique URL for a website. For example, if a user enters " http://www.google.com/ ", store it in the database as " google.com " after parsing it. Basically, I need a consistent agreement for URLs so that there are no multiple entries for the same site.

Basically, is it ok to accept "www" from all the entered URLs? Or should I hold it?

I like hearing your opinions.

Thanks in advance!

+3
source share
9 answers

, www.google.com DNS, google.com, , , . , www2.foo.com , , foo.com .

, .

+11

. URL-, . - 4 , . , , ( "http://" ).

URL- , "http://www.

+7

, GET , . , , www.stackoverflow.com stackoverflow.com, URL .

, ; .

+4

, " ". Nothing.sitename.com , www.sitename.com. Infact, anything.sitename.com www.sitename.com

www.sitename.com == sitename.com

,

blog.sitename.com != sitename.com
+2

, 4 ? . , URL-, , www, . , URL-, , www, .

, , URL-, , , .

+1

/ , -/ www.domain.com vs. domain.com, , , , www.

+1

http://, www 100% . www foo.com. -, , www. DNS-, www - , HTTP, foo.com - www.foo.com , www.foo.com.

So no, it would be safe to strip www, as this is a different address for the bare version of the same URL. In addition, you can also incur redirection costs for those websites that use the HTTP redirect method, for example. http://google.com .

0
source

Source: https://habr.com/ru/post/1730812/


All Articles