简体   繁体   中英

unable to rewrite url through .htaccess file

I want the url:

www.tricore.in/viewdoc.php?did=2&title=mca-sem-2-syllabus

to rewrite like:

http://tricore.in/docs/2/mca-sem-2-syllabus

But whenever I am clicking on any Link from www.tricore.in , the rewriting is not happening.

Below is the code of .htaccess file:

<IfModule mod_rewrite.c>
   RewriteEngine On 
   RewriteBase /
   RewriteRule ^browse/docs/(.*)/(.*)/(.*)/(.*) docs.php?sortby=$1&filter=$2&page=$3&title=$4
   RewriteRule ^browse/categories/doc/(.*)/(.*)/(.*)/(.*) categorydocs.php?sortby=$1&filter=$2&page=$3&title=$4
   RewriteRule ^browse/categories/docs/(.*)/(.*)/(.*)/(.*) categorydocs.php?sortby=$1&filter=$2&page=$3&title=$4
   RewriteRule ^docs/(.*)/(.*) viewdoc.php?did=$1&title=$2
   RewriteRule ^confirmemail/(.*) confirmemail.php?code=$1
   RewriteRule ^download/doc/(.*)/(.*) downloaddoc.php?DID=$1&title=$2
   RewriteRule ^browse/members/(.*)/(.*)/(.*)/(.*) members.php?sortby=$1&filter=$2&page=$3&title=$4
   RewriteRule ^categories/ categories.php
   RewriteRule ^members/profile/(.*)/(.*) memberprofile.php?pid=$1&username=$2
   RewriteRule ^search/(.*)/(.*)/(.*)/(.*) search.php?searchfor=$1&sortby=$2&page=$3&searchterm=$4
   RewriteRule ^syndicate/docs/(.*)/(.*) syndicatedocs.php?filter=$1&title=$2
   RewriteRule ^resetpassword/(.*) resetpassword.php?code=$1
   RewriteRule ^resendconfirmation/(.*) resendconfirmation.php?userid=$1
</IfModule>

<IfModule mod_security.c> 
   # Turn off mod_security filtering. 
   SecFilterEngine Off 

   # The below probably isn't needed, 
   # but better safe than sorry. 
   SecFilterScanPOST Off 
</IfModule>

Please tell me, where am I going wrong?

Thank you.

Please use the below rewrite rule. For this specific part.

RewriteRule ^docs/([^/]*)/([^/]*)$ /viewdoc.php?did=$1&title=$2 [L]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM