0
votes

i have a wordpress site that currently shows the posts like

http://mysite.com/index.php?p=1 

and now i wanna access the same thing by writing url as

http://mysite.com/1

what can be the rewrite rules to do that.. i saw the .htaccess that hides the index.php from the url and regular expressions but was not being able to properly do what is needed!

1

1 Answers

1
votes

In the htaccess file in your document root, preferably before any wordpress related rewrite rules, add these:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/?([0-9]+)$ /index.php?p=$1 [L,QSA]