Reputation: 134
I'm dissecting urls for SEO purposes and I'm searched all forums for a formula that can remove the domain from a url, but can't seem to find the formula that returns favorable results. This is what I want to do:
https://www.walsallhealthcare.nhs.uk/contact-us/useful-links/subject-categories.aspx
--> contact-us/useful-links/subject-categories.aspx
I'm using this formula in Excel to remove domain. However this doesn't work for secured sites, and I always have to replace "8" with "9" to make it work. Is there any way to make this work for both http and https websites?
=MID(A1,FIND("/",A1,8),LEN(A1)+1-FIND("/",A1,8))
Also, I want to remove the "/" at the beginning. Is this possible?
Thank you so much!
Upvotes: 5
Views: 8221
Reputation: 1
=RIGHT(LEFT(A3;FIND("/";A3;FIND("//";A3)+2)-1);LEN(LEFT(A3;FIND("/";A3;FIND("//";A3)+2)))-FIND("//";A3)-2)
If url in A3 field, strips http://
and https://
from A3 and returns only domain name without request URI
Upvotes: -1
Reputation: 5509
Is it mandatory to be in excel? You can use google sheets and this simple function will autoextract exactly what you need:
=REGEXEXTRACT(A1,".*\.\w+\/(.*\/*?)")
Upvotes: 0
Reputation: 11
If you are creating 301 rules, adding a "+1" will make sure the "/" is included in the beginning of the path :
=RIGHT(A3,LEN(A3)-FIND("/",A3,FIND("//",A3)+2)+1)
Upvotes: 1
Reputation: 868
I tried this with the http and https versions of your URL (where A3 has your URL); seems to work.
=RIGHT(A3,LEN(A3)-FIND("/",A3,FIND("//",A3)+2))
Upvotes: 5