Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何更改默认登录页url_Url_Redirect_Url Rewriting - Fatal编程技术网

如何更改默认登录页url

如何更改默认登录页url,url,redirect,url-rewriting,Url,Redirect,Url Rewriting,我想将我的登录页url从更改为 我试过这个 <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /example/ RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f Redirect 301 / http://example.com/index/id RewriteRule ^index/([^/]*)$ ?i=page.index

我想将我的登录页url从更改为

我试过这个

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /example/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f

Redirect 301 / http://example.com/index/id

RewriteRule ^index/([^/]*)$ ?i=page.index&lang=$1 [L]

</IfModule>

重新启动发动机
重写基础/示例/
重写cond%{REQUEST_FILENAME}-D
重写cond%{REQUEST_FILENAME}-F
重定向301/http://example.com/index/id
重写规则^index/([^/]*)$?i=page.index&lang=$1[L]
但这不管用


请帮我把这个修好。谢谢。

要将URL从
index.php
重写为
/index/id
,您需要遵循以下两个步骤:

  • 在根目录中创建一个名为
    .htaccess
  • 复制下面的代码,并将其粘贴到先前创建的
    .htaccess
    文件中
  • 但是有一个问题,这段代码只允许你用另一个名字访问
    index.php
    ,如果你想将
    index.php
    的所有流量重定向到新名字,我建议你不要在
    中做任何更改。htaccess
    文件只需在
    index.php
    文件中检测当前的
    URL
    ,然后根据需要重定向它需要

    范例

    <?
    $actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
    if(parse_url($actual_link, PHP_URL_PATH) != "/index/id"){
    header('Location: /index/id');
    }
    else{
    // do nothing 
    }
    ?>
    
    
    

    希望这将有助于你,谢谢你嘿发生了什么告诉我,你尝试了我的代码还是没有?
    <?
    $actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
    if(parse_url($actual_link, PHP_URL_PATH) != "/index/id"){
    header('Location: /index/id');
    }
    else{
    // do nothing 
    }
    ?>