I was testing a web service in PHP and Python. The address of the web service was, let's say, http://my.domain.com/my/webservice
. When I tested the web service in PHP using that URL everything worked fine. But, when I used the same location but in Python using SOAPpy I got an error.
Below is the code I used to communicate with the web service (Python):
from SOAPpy import WSDL
server = SOAPProxy('http://my.domain.com/my/webservice', namespace)
server.myFunction()
The respond I got from the server:
HTTPError: <HTTPError 301 Moved Permanently>
I figure out that if I add a trailing slash to the web service location it works!
from SOAPpy import WSDL
server = SOAPProxy('http://my.domain.com/my/webservice/', namespace)
server.myFunction()
Why the lack of the trailing slash causes the error?
Trailing slashes can split your link equity in half It's the idea that when web pages link to other pages, they're endorsing that content by transferring link equity. The more link equity a page has, the more powerful the endorsement. It's the underlying principle behind 'PageRank', one of Google's original algorithms.
A trailing slash is a forward slash (“/”) placed at the end of a URL such as domain.com/ or domain.com/page/. The trailing slash is generally used to distinguish a directory which has the trailing slash from a file that does not have the trailing slash. However, these are guidelines and not requirements.
The short answer is that the trailing slash does not matter for your root domain or subdomain. Google sees the two as equivalent. But trailing slashes do matter for everything else because Google sees the two versions (one with a trailing slash and one without) as being different URLs.
They're different URLs. http://my.domain.com/my/webservice
implies a file webservice
in the my
folder. http://my.domain.com/my/webservice/
implies the default document inside the my/webservice folder.
Many webservers will automatically correct such URLs, but it is not required for them to do so.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With