简体   繁体   中英

Wordpress website can't find URL without trailing forward slash

I'm using wordpress in my website and I have issues with the short URLs. For example the URL

mywebsite/page/

works fine and sends me to the page. But the URL

mywebsite/page (without the '/')

gives me a blank page. This happens in my online server (one.com) but not on my localhost. It happens with all the pages, so it's not because of conflicting URLs.

I assume the problem is in the server settings, but what is it exactly?

Did you try and change your permanent links settings under Control Panel -> Settings -> Permalinks? Maybe you have your own structere set?

Cheers, Nicolaj

EDIT:

Try adding this to your .htaccess file. This will force a rewrite of links without the trailing slash.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*[^/])$ http://%{HTTP_HOST}/$1/ [L,R=301]

Try adding this to your .htaccess file

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM