无法通过.htaccess文件重写网址

时间:2022-11-24 00:20:58

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.

但每当我点击www.tricore.in上的任何链接时,重写都不会发生。

Below is the code of .htaccess file:

下面是.htaccess文件的代码:

<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.

1 个解决方案

#1


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

请使用以下重写规则。对于这个特定的部分。

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

#1


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

请使用以下重写规则。对于这个特定的部分。

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