问题
My setup is as follows:
- I've created a Wordpress site in Hebrew with the Wordpress Hebrew version.
- I added a theme from themeforest that do not have WooCommerce but support it. The theme supports RTL and I need it.
- The site is on a sub directory because it is still on testing, the old site is asp.net on a windows server that supports PHP and MySQL.
My problem is that my link to the product has a Hebrew word in it, like this:
http://sitename.co.il/wp/index.php/מוצר/test-mil/
. This URL causes a 404 error, but if I'm using this URL:
http://sitename.co.il/wp/index.php/product/test-mil/
I can get to the page.
All the other links are working as they should.
What I've tried:
- I looked and found that changing the permalinks can help. I tried it, but it adds an extra
"/"
that causes a problem - when I change the permalink the URL look like this:http://sitename.co.il/wp/index.php//product/test-mil/
(Note the double//
) - I editing the PO file of WooCommerce, and change the slug from Hebrew to English, but this did not help.
Can this be a server problem?
If so, and if I move to a linux server, can I use 301 redirect form the asp.net pages to the new pages?
回答1:
It appears you're using IIS 7 on Windows. Having 404 issues with non-ASCII slugs is a known server issue for IIS 7.
On some instances, the issue can be fixed by adding the following code right after the WP_DEBUG constant definition in wp-config.php:
if (isset($_SERVER['UNENCODED_URL'])) {
$_SERVER['REQUEST_URI'] = $_SERVER['UNENCODED_URL'];
}
The other option you have is to move to an Apache server, where these URLs are supported properly. In this case you will be able to create the necessary 301 redirects quite easily.
回答2:
SOlved it !
You should change the default permalink in Wordpress Admin panel : Go to Setting in the dashboard choose permalink and scroll down to change the permalink for the product. Select the custom option (the last one) and write in English : product. That will do it !
来源:https://stackoverflow.com/questions/25487444/woocommerce-url-with-a-hebrew-word