简体   繁体   中英

301 redirection in .htaccess vs PHP http_redirect()

关于SEO,性能或其他方面,在.htaccess文件中设置301重定向与调用PHP http_redirect()是否有任何区别

Using the .htacess method prevents PHP being invoked which is technically faster. As it's sometimes said that SEO is influenced by response time, this can be a benefit.

Next to that webservers most often have a better implementation of the redirect procedure which is often honoured by SEO - and if not that, then by your potential site users.

If you're looking for a better implementation in PHP, see http_redirect .

Technically there is no difference. The response from the server would be the same.

Also, I'd say that there's no difference in performance, or that it's not really measureable.

In either case, the server has to open a file (either .htaccess or .php) and would then redirect. I'm unsure, if loading the php processor would make a noticeable difference. Maybe if the site is hammered by thousands of requests per second. ;)

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