: URL rewriting removing question mark and replace it with slash How can I rewrite my URL from edit.php?id=2 to edit/id/2?
How can I rewrite my URL from edit.php?id=2 to edit/id/2?
More posts by @Kimberly868
2 Comments
Sorted by latest first Latest Oldest Best
In case you need redirect from:
yoursite.com/subpage1/subpage2/?YOURSTRING=blabla ----------> yoursite.com/subpage1/subpage2/
then in the beginning of .htaccess, insert:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{QUERY_STRING} YOURSTRING=(.*)
RewriteRule ^(.*)$ /? [R=301,L]
</IfModule>
## If WordPress is not installed in root folder, then edit the fourth line like this
RewriteRule ^(.*)$ /YOUR-WORDPRESS-DIRECTORY/? [R=301,L]
p.s. if you want other redirection from QUESTION MARK, then use: stackoverflow.com/a/15680832/2377343
Try this
RewriteEngine On
RewriteBase /
RewriteRule ^edit/id/([0-9]+)/?$ edit.php?id= [NC,QSA,L]
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.