I have 2 pages in selecting data from mysql. First page – readmore.php, to get posts with url from table posts. Second page – categories.php to get data with caturl from table categories.
readmore.php in .htaccess
RewriteEngine On
RewriteRule ^([a-zA-Z0-9-/]+).html$ readmore.php?url=$1
RewriteRule ^([a-zA-Z0-9-/]+).html/$ readmore.php?url=$1
categories.php in .htaccess
RewriteEngine On
RewriteRule ^([a-zA-Z0-9-/]+).html$ categories.php?caturl=$1
RewriteRule ^([a-zA-Z0-9-/]+).html/$ categories.php?caturl=$1
My problem located when get caturl htaccess redirects me to readmore.php but I want redirect to categories.php
You are redirecting *.html to a new url
readmore.php?url=*therefor the url changes.Since the url is now
readmore.php?url=*the second set of rules won’t fire (there is no longer a pattern that matches *.html).Therefor categories will never be loaded. You will need to add a parameter in your url to distinguish the different types.
So make sure all your articles (or categories) have a common part in the url to indicate it is an page of that type.
Example:
So an article that was called
article_firstpost.htmlwould link toreadmore.php?url=firstpostandcat_cars.htmlwould link tocategories.php?caturl=cars