I have a site in wordpress in which a page is showing questions based on its ID
.
http://example.com/index.php/question/?questionid=9&title='how-to-rewite-htaccess'
I am the beginner to php I'm not able to graps other examples found on stackoverflow.com
Here's my .htaccess code
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteRule ^/question/([^/]*)/([^/]*)/$ /question/?questionid=$1&title=$2 [NC,L]
</IfModule>
But this is not working. please tell where is error.
Since your using Wordpress you can turn on permalinks which takes care of the url friendly urls for you see https://codex.wordpress.org/Settings_Permalinks_Screen.
Login to your admin then go to permalinks and set a preferred style.
Once you go to setting > permalinks and set the pretty links, WordPress will automatically generate .htaccess based on the setting you choose. Don't forget to save.
More information here http://www.wpbeginner.com/beginners-guide/why-you-cant-find-htaccess-file-on-your-wordpress-site/
example.com/index.php/question/9/how-to-rewite-htaccess
doesn't match your rewrite rule because the rule has a trailing /
. Change the regex (first) part of your rewrite rule to:
^/question/([^/]*)/([^/]*)/?$
Adding ?
makes the trailing /
optional.