R
R
Roma2018-01-31 00:26:34
PHP
Roma, 2018-01-31 00:26:34

What is better header() vs htaccess?

Hello everyone, what is better to use the header php function for a 301 redirect or still htaccess if I have 5060 redirects =) What will work faster? Thank you for your attention =)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2018-01-31
@B_Roma

Each of the tools has its own advantages.
HTACCESS
is the "expected" place for such things, and SEOs will go there looking for them.
+ There are many ready-made presets and generators for the rules.
- Strange behavior of redirects (you need to know mod_rewrite well to understand what is happening and why)
- does not work on nginx and iis
- difficulty creating redirects with get parameters.
- a large number of redirects reduces site performance (But in practice it is not noticeable)
php
+ no problems with redirects of GET parameters
+ no sequence of codes like 301 +301 +301+200
+ you can make a redirect like 301 if the current status of the url is 404 and indeed you can put in
404.php (in .htaccess it is also possible but through ...)
+ will work on any web server
- non-standard place and no one will look for them
- seo expert does not know php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question