Php rewrite url through .htaccess

前端 未结 1 894
孤城傲影
孤城傲影 2021-01-13 03:17

I want to rewrite some url by using .htaccess rewrite

I have url something like this:

domain.com/app/index.php/appmedia/default/lo

相关标签:
1条回答
  • 2021-01-13 03:51

    You can't use a [R=301] and expect the URL not to change. R means redirect. So it will change to the URL you told it to. For an internal rewrite you need to leave that off.

    If you have .htaccess in your document root then you should be able to do this. I don't know how your setup is but this should rewrite the URI.

    Options -Multiviews
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^app/index.php/appmedia/default/login/?$ /app/index.php/zurmo/default/login [L]
    

    If you are using yii framework do like this:

    'urlManager' => array (
     'class' => 'application.core.components.ZurmoUrlManager',
     'urlFormat' => 'path',
    'caseSensitive' => true,
    'showScriptName' => true,
    'rules' => array(
     // Begin Not Coding Standard
     // API REST patterns
     array('zurmo/default/login','pattern' => 'appmedia/default/login', 
    
    0 讨论(0)
提交回复
热议问题