Page 1 of 1

Extensionless URLs

Posted: Mon Aug 03, 2015 1:44 pm
by GerardF
Not exactly a Webbuilder Extension, but a tool to remove the .html extension from the internal links on your published pages, providing links to extensionless URLs

What are extensionless URL's?
Extensionless URL's are URL's that do not have the (in this case) .html extension. For example, http://mywebsite/us/products.html becomes http://mywebsite/us/products

For more info see: http://rjsoft.net/us/extensionless

Image

Re: Extensionless URLs

Posted: Mon Aug 03, 2015 2:13 pm
by zinc
This is very clever and seems easy to use. I shall give it a try and see... Well done.

Re: Extensionless URLs

Posted: Tue Aug 04, 2015 10:03 am
by tommy888
GerardF,

Extention if it works is useful. Have you removed the pages from your server? It redirects to 1&1 main page. Changing/shortening file names may be confusing at times and cause errors. Also one must be careful adding trailing hash at the end of the www address. At that point, given www addresses results in redirection/error. It can also be done via .htaccess file in main website folder by adding lines:

PHP EXTENTION REMOVAL
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]

HTML EXTENTION REMOVAL
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]


Please verify it. Thanks.

Re: Extensionless URLs

Posted: Tue Aug 04, 2015 10:10 am
by GerardF
Hello Tommy888,

I can confirm that the url http://rjsoft.net/us/extensionless still works.

Re: Extensionless URLs

Posted: Tue Aug 04, 2015 10:25 am
by tommy888
I don't say it doesn't work. I only mentioned the url addresses given are redirected to 1&1 home page or produce an error.

Re: Extensionless URLs

Posted: Tue Aug 04, 2015 10:30 am
by GerardF
Hello Tommy888

I'm sorry, exactly what url addresses are you referring to?

Re: Extensionless URLs

Posted: Tue Aug 04, 2015 4:47 pm
by tommy888
The ones you mentioned as examples: http://mywebsite/us/products.html
Probably you no longer host pages there.

Re: Extensionless URLs

Posted: Tue Aug 04, 2015 5:11 pm
by BaconFries
This was just used as an example :?....the op writes this in his original post.

Re: Extensionless URLs

Posted: Tue Aug 04, 2015 5:33 pm
by tommy888
I thought so BaconFries :) but they are actually links so it may be confusing a bit.

Re: Extensionless URLs

Posted: Tue Aug 04, 2015 5:35 pm
by tommy888
You should bear in mind that when path names are altered, sitemap must also be changed and best delivered to Google Webmaster Tools by uploading current sitemap.xml as soon as possible otherwise users get an error message.

Re: Extensionless URLs

Posted: Wed Aug 05, 2015 7:19 am
by GerardF
Ah, I understand the confusion. The links are indeed given as an example and are not real existing links.
I thought it would be obvious that the domain 'mywebsite' does not exist, but apparently I thought wrong :(
You should bear in mind that when path names are altered, sitemap must also be changed
You are right, the tool can do this by checking the 'Include sitemap.xml' option.

Re: Extensionless URLs

Posted: Sat Aug 06, 2016 12:08 pm
by vijayaraghavan.r
I am not a techie. For the last few months, "htaccess for extensionless URL" has put me into lots of challenges with time consuming references, try different codes, checking root directory for files, auto-write htaccess codes, and so on. Pablo is a wonderful person who has given fantastic hints about the .htaccess code and hide for extension option in Preview & Publish. I will share my experience. After many references, I had almost given up.

Yet, I went into this File>Options>Publish & Preview>Links (for advanced users only). From here, I went to Help mode, as he directed. Without any negligence, I went to help mode and checked. There, I found this.

WARNING:
The generated files will still have extensions otherwise they will not be recognized as HTML/PHP files on the server!
So this means that internal links will no longer work unless you have configured the server to support pages without file extensions!
You will need to configure the server to hide the extensions on the server via .htaccess.
DO NOT enable this option unless you have configured the server to support this functionality!
We cannot provide support on configuring the server or editing .htaccess. Use at your own risk!

Example of .htaccess file to enable support for pages without file extensions:

PHP EXTENTION REMOVAL
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]

HTML EXTENTION REMOVAL
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]

For my site building, I use html, I copied this second part of the code (which is meant for .html) and pasted in Notepad and saved it as .htaccess. Using FTP Software, i moved this file into my directory where I found all my .html files and images etc. I came back to open WYSIWYG Builder, opened my site, went to File>Options>Publish & Preview>Links (for advanced users only). Then enabled this button "Hide For Extension For Internal Links". I went and then published the whole site once again. It worked to my surprise. I was thrilled. Just thought of sharing this method, in case if some one is struggling to know what is .htaccess / where to place / how to use it / how to enable it through WYSIWYG.

Hats off Pablo....You are making people like us to grow. Thanks Sir.