在我的网站上输入网址时,会在最后添加字词

时间:2016-02-14 09:14:25

标签: php wordpress

我有一个问题,我尝试使用谷歌搜索解决方案,但找不到它。当我输入网站页面的URL或从书签访问它时,它会在URL的末尾添加单词,从而导致404错误。

所以我有这个网址:

https://www.mywebsite.com/whmcs/admin/

当我键入URL或从书签访问它时,它会返回:

https://www.mywebsite.com/whmcs/admin/whmcs/admin/

这是一个WordPress网站。可能是什么问题呢?提前谢谢。

# 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] 

    RewriteCond %{HTTP_HOST} !^www\. 
    RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI}$1 [R=301,L]

    RewriteCond %{HTTPS} off 
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI}$1 
</IfModule> 
# END WordPress

2 个答案:

答案 0 :(得分:0)

RewriteEngineRewriteBase

之间应该存在换行符
RewriteEngine On
RewriteBase /

答案 1 :(得分:0)

Try this in htaccess file
RewriteEngine On

# Assuming you're running at domain root.  Change to working directory if needed.
RewriteBase /

 # www check
# If you're running in a subdirectory, then you'll need to add that in
# to the redirected url (//your URL/subdirectory/$1

RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ ://your URL/$1 [R=301,L]

#
# Trailing slash check

# Don't fix direct file links
RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ $1/ [L,R=301]


# Finally, forward everything to your front-controller (index.php)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [QSA,L]