drbvm26000 2017-10-16 20:04
浏览 229
已采纳

所有页面都重定向到主页

Hi I am having a funny issue with Wordpress runnign on XAMPP. Mysteriously all of my pages including my admin page are redirecting to my home page which is hosted on:

http://localhost/client_projects/Active/example-site.co.uk

This is what my .htaccess file looks like:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /http://localhost/client_projects/Active/example-site.co.uk/index.php
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . http://localhost/client_projects/Active/example-site.co.uk [L]
</IfModule>

# END WordPress

I have also made sure that in phpmyadmin my table wp_options that siteurl and home fields are both pointing to http://localhost/client_projects/Active/example-site.co.uk

I unfortunately can not access my admin panel.

Why is my wordpress doing this?

EDIT:

On updating my .htaccess file to the following, all of my pages get redirected to localhost/dashboard:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

I have been working with Laravel and added the following to my https-vhosts.conf file:

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs"
    ServerName localhost
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/php/frameworks/laravel/lsapp/public"
    ServerName lsapp.dev
</VirtualHost>

And my windows32/drivers hosts file

127.0.0.1 localhost 
127.0.0.1 lsapp.dev

I am not sure if this is affecting anything, I have tried to revert the changes and it doesn't affect anything.

  • 写回答

3条回答 默认 最新

  • douyan1944 2017-10-16 20:18
    关注

    If you have WP installed in C:/xampp/htdocs/client_projects/Active/example-site.co.uk/ than change the RewriteBase accordingly:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /client_projects/Active/example-site.co.uk/
        RewriteRule index\.php$ - [L]
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule . index.php [L]
    </IfModule>
    # END WordPress
    

    The reason why all your request going to the main page it the following:
    RewriteRule . http://localhost/client_projects/Active/example-site.co.uk [L]

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?