.htaccess - Rewrite url in htaccess php
Get the solution ↓↓↓I want to rewrite url as following.
This is url : http://www.xyzdomain.com/?page=9
i want it like this : http://www.xyzdomain.com/9
Answer
Solution:
Add this to the htaccess file in your document root:
RewriteEngine On
RewriteCond %{THE_REQUEST} \ /+\?page=([0-9]+)
RewriteRule ^ /%1? [L,R]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([0-9]+)$ /?page=$1 [L,QSA]
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: php undefined array key
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.