I am new to PHP. I created a website which creates a multiplication table from given input number.
Now I want that instead of submitting the input, a number multiplication table should be accessible through URL.
i.e. www.multiply.com/multiplication-of-13.php.
Creating a single page for every doesn’t seem like a feasible solution,
So I did it using the .htaccess file by changing the query parameter to URL.
Example :
RewriteEngine on
Options +FollowSymlinks
RewriteBase /
RewriteRule ^multiplication-of-([0-9]+).php$ index.php?num=$1 [R]
Now the problem is this configuration is generating 302 redirect, which is not suitable for SEO, and if I use [R=301] then the changes reflect in the URL, which does not seem user-friendly, Is there is any possible solution that the URL redirection doesn’t return HTTP Code 302?
2
Answers
Take off the
[R]
after the URL. That means “redirect,” which is explicitly what you are asking not to happen.The [R] in your rewrite is causing it to generate a 302.