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
mod rewrite.htaccess URL重定向_.htaccess_Url - Fatal编程技术网

mod rewrite.htaccess URL重定向

mod rewrite.htaccess URL重定向,.htaccess,url,.htaccess,Url,我只想将www.mysite.com/corporate指向www.mysite.com/services/corporate 这是我的.htaccess: #DirectoryIndex index.php index.html #Options +FollowSymLinks #Options -Indexes #ErrorDocument 403 default <IfModule mod_rewrite.c> RewriteEngine On Rewrite

我只想将www.mysite.com/corporate指向www.mysite.com/services/corporate

这是我的.htaccess:

#DirectoryIndex index.php index.html
#Options +FollowSymLinks
#Options -Indexes
#ErrorDocument 403 default

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
        RewriteRule ^corporate$ services/corporate
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^(.+) - [PT,L]

    RewriteCond %{REQUEST_URI} !=/favicon.ico
    RewriteRule ^(.*) index.php

    RewriteCond %{HTTP:Authorization}  !^$
    RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
</IfModule>

#php_value register_globals 0
#DirectoryIndex.php index.html
#选项+FollowSymLinks
#选项-索引
#错误文档403默认值
重新启动发动机
重写基/
重写规则^corporate$服务/公司
RewriteCond%{REQUEST_FILENAME}-f[或]
RewriteCond%{REQUEST_FILENAME}-d
重写规则^(+)-[PT,L]
重写cond%{REQUEST_URI}=/图标文件
重写规则^(.*)index.php
重写cond%{HTTP:Authorization}^$
重写规则。*-[E=远程用户:%{HTTP:Authorization}]
#php\u值寄存器\u全局0

使用
mod\u rewrite.
在根目录的.htaccess中放置类似的内容:

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)/corporate/(.*)$ $1/services/corporate/$2 [R,L] 

有关更多信息,请参阅。

难以理解.htaccess代码的某些部分,但您可以在
之前再添加一行:

RewriteRule ^corporate/?$ services/corporate [NC,L,R=301]