I have many hyperlinks like this: This link is placed in interact folder and links to the main folder.
<a href='../user/" . $id . "/".$name."' target='_self'>" . $name. "</a>
Which goes back to the main directory of the website and in the main directory there is a .htaccess
file with this code
RewriteRule ^user/([0-9]*) interact/profile1.php?id=$1 [L,QSA]
I have done this to make URL look like:
http://www.domain.com/user/
Instead of this:
http://www.domain.com/interact/user
This makes the request return to the same directory it came from that is the /interact directory. I have many hyperlinks that do something like this. Will having many such hyperlinks increase the CPU load time ?
Yes, using rewriting uses more CPU. But it does not depend on the number of links, it depends on the number of requests done.
And additionally, using a .htaccess file also impacts performance. A lot more than rewriting.
Rewriting inside .htaccess has a double impact, because evaluating the .htaccess file takes place relatively late in the process, and a rewrite there basically starts the whole process all over.
On the other hand the impact is measurable, but rarely noticeable on the average server. Are you in a high traffic situation? Then I'd suggest getting rid of the .htaccess files altogether, disabling them in the Apache configuration, and putting the rewriting rule into the vhost configuration.
Residing there, they only have to be parsed when the server starts, and you avoid that the server constantly has to look for a .htaccess file in any directory that might be touched by a request.