Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.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
使用.htaccess重定向子目录_.htaccess_Redirect_Parameters - Fatal编程技术网

使用.htaccess重定向子目录

使用.htaccess重定向子目录,.htaccess,redirect,parameters,.htaccess,Redirect,Parameters,我的第一个问题在这里!:)你好! 我在.htaccess上遇到了一些问题 工作 不起作用 当我尝试这个: RewriteBase /subdir RewriteRule ^index.php - [L] RewriteRule ^([^/]+)/?$ index.php?i=$1 [R,L] 我得到一个404.shtml错误,比如http://www.domain.com/subdir/index.php?i=404.shtml 此外,wp admin(http://www.domain.co

我的第一个问题在这里!:)你好!

我在.htaccess上遇到了一些问题

  • 工作
  • 不起作用 当我尝试这个:

    RewriteBase /subdir
    RewriteRule ^index.php - [L]
    RewriteRule ^([^/]+)/?$ index.php?i=$1 [R,L]
    
    我得到一个404.shtml错误,比如http://www.domain.com/subdir/index.php?i=404.shtml

    此外,wp admin(http://www.domain.com/wp admin/)通过404.shtml重定向到子目录。如何获取http://www.domain.com/subdir/example这样的url/


    有人能帮我吗??先进的Thnx

    假设这是一个WordPress安装(基于“wp admin”一词),您需要以下内容

    只需使用WordPress标准,将此.htaccess放入根文件夹

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /subdir/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /subdir/index.php [L]
    </IfModule>
    
    转到设置>永久链接,并将永久链接结构更改为您需要的任何内容

    p、 要访问wp admin,您需要导航到
    http://www.domain.com/subdir/wp-admin/


    更多信息请点击此处:

    Thnx,但这不是正确的解决方案。Wordpress安装在根目录中。。这是另一个php文件除了wordpress!RewriteRule^([^/]*)/$/subdir/index.php上的RewriteEngine?i=$1[L]在URL为/但不使用最新的/时工作。。如何修复此问题?@user1263678允许跟踪/仅将
    /$
    更改为类似
    [/]?$
    <?php
    
        define('WP_USE_THEMES', true);
    
        /** Loads the WordPress Environment and Template */
        require('./subdir/wp-blog-header.php');
    ?>