I have noticed my url rewrite code works fine only if i click a page the from homepage . If i click another page it just doesn't rewrite the url.
Example . i click contact page from homepage . it rewrites fine to site.com/page/contact . But if i click the about us page from the contact page , instead of displaying the about us page as site.com/page/about-us , it displays site.com/page/page.php?page=about-us .
here is my .htaccess code
AddDefaultCharset UTF-8
Header unset ETag
FileETag None
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+post\.php\?post=([^\s&]+) [NC]
RewriteRule ^ post/%1? [R=301,L]
RewriteRule ^post/([^/]+)/?$ post.php?post=$1 [L,QSA]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+page\.php\?page=([^\s&]+) [NC]
RewriteRule ^ page/%1? [R=301,L]
RewriteRule ^page/([^/]+)/?$ page.php?page=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
I have little knowledge of url rewriting, it took me weeks to even get this to work. Please what did i write wrong ? Thanks
Link clicked from homepage site.com/page/page.php?page=about-us , rewrites to site.com/page/about-us.
Link clicked from any other page that has had its url rewritten , e.g. from about us page clicked earlier , Lets say i clicked the contact page from it site.com/page/page.php?page=contact , it should rewrite to site.com/page/contact , but it does not rewrite .