doudou8783 2017-01-16 06:27
浏览 17

htaccess后发送内容? 作为参数

This is my input URL

http://site_name/project/edit/sgdsg/getFile/?file=271bbec45d7855a332e6dfda85ca94b9.txt

I want it to be sent like http://site_name/project/edit/sgdsg/getFile/271bbec45d7855a332e6dfda85ca94b9.txt

How can we do this? I want this only for the URL starting with http://site_name/project/edit/sgdsg/getFile/ So it don't affect any other URL.

This is what I have tried ...

RewriteRule ^project/edit/([A-Za-z0-9._-]+)/([A-Za-z0-9._-]+)/([A-Za-z0-9._-]+)/?$ modules-nct/edit_project-nct/index.php?slug=$1&action=method&method=$2&file=$3 [L]
RewriteRule ^project/edit/([A-Za-z0-9._-]+)/([A-Za-z0-9._-]+)/?$ modules-nct/edit_project-nct/index.php?slug=$1&action=method&method=$2 [L]
RewriteRule ^project/edit/([A-Za-z0-9._-]+)/?$ modules-nct/edit_project-nct/index.php?slug=$1 [L]

Please don't give it negative ratings just because my editing is improper.I am here to learn something new.

Thanks.

  • 写回答

1条回答 默认 最新

  • doubo4824 2017-01-16 06:52
    关注

    In your <a> tag:

    <a href="your_url/your_other_parameters(means :project/edit/sgdsg/getFile/ )/directly enter your file name that you want to pass"> i.e your <a> tag must be
    
    <a href="http://site_name/project/edit/sgdsg/getFile/271bbec45d7855a332e6dfda85ca94b9.txt"></a>
    

    In htaccess:

    RewriteRule ^project/edit/([A-Za-z0-9._-]+)/([A-Za-z0-9._-]+)/([A-Za-z0-9._-]+)$ modules-nct/edit_project-nct/index.php?slug=$1&action=method&method=$2&file=$3
    

    In the above line, the href URL will be redirected to an original URL.

    评论

报告相同问题?