简体   繁体   中英

Confusion regarding SEO friendly PHP links

Is SEO affected by the type of titles PHP generates?

Eg: CamelCased link (not easy to read) http://website.com/HelloWorld.php
or
Link with hypen (easy readable) http://website.com/hello-world.php

What's your opinion on this? Which rules are to be followed to keep my webpages search engine friendly?

The - is a word separator. In Hello-World, google recognises the words, hello and world. HelloWorld will be understood as one word, and will not contribute to the term hello world. Also important, the underscore character (_), is not a word separator, so Hello_World will not be recognised as hello world.

If you want to achieve this by .htaccess I suggest using this:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [NC,L]

Which drops the .php and allows for more SEO-friendly URLs eg http://website.com/2012/02/04/name-of-the-article . Inside the index.php catch the URI with $_SERVER['REQUEST_URI'] and include the file you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM