Extensionless URLs

In this section you can share self-made extensions with other users of WYSIWYG Web Builder.
There is a dedicated section for commercial extensions.
Post Reply
GerardF
 
 
Posts: 7
Joined: Mon Jan 05, 2015 11:38 am
Location: Amsterdam
Contact:

Extensionless URLs

Post 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
Last edited by GerardF on Wed Aug 05, 2015 7:12 am, edited 1 time in total.
User avatar
zinc
 
 
Posts: 2146
Joined: Sat Dec 08, 2007 3:06 pm
Location: London, United Kingdom
Contact:

Re: Extensionless URLs

Post by zinc »

This is very clever and seems easy to use. I shall give it a try and see... Well done.
Running WYSIWYG Web Builder since 2007...
User avatar
tommy888
 
 
Posts: 214
Joined: Mon Sep 28, 2009 5:41 pm
Location: Poland
Contact:

Re: Extensionless URLs

Post 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.
Last edited by tommy888 on Tue Aug 04, 2015 10:16 am, edited 1 time in total.
GerardF
 
 
Posts: 7
Joined: Mon Jan 05, 2015 11:38 am
Location: Amsterdam
Contact:

Re: Extensionless URLs

Post by GerardF »

Hello Tommy888,

I can confirm that the url http://rjsoft.net/us/extensionless still works.
User avatar
tommy888
 
 
Posts: 214
Joined: Mon Sep 28, 2009 5:41 pm
Location: Poland
Contact:

Re: Extensionless URLs

Post 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.
GerardF
 
 
Posts: 7
Joined: Mon Jan 05, 2015 11:38 am
Location: Amsterdam
Contact:

Re: Extensionless URLs

Post by GerardF »

Hello Tommy888

I'm sorry, exactly what url addresses are you referring to?
User avatar
tommy888
 
 
Posts: 214
Joined: Mon Sep 28, 2009 5:41 pm
Location: Poland
Contact:

Re: Extensionless URLs

Post by tommy888 »

The ones you mentioned as examples: http://mywebsite/us/products.html
Probably you no longer host pages there.
User avatar
BaconFries
 
 
Posts: 5316
Joined: Thu Aug 16, 2007 7:32 pm

Re: Extensionless URLs

Post by BaconFries »

This was just used as an example :?....the op writes this in his original post.
User avatar
tommy888
 
 
Posts: 214
Joined: Mon Sep 28, 2009 5:41 pm
Location: Poland
Contact:

Re: Extensionless URLs

Post by tommy888 »

I thought so BaconFries :) but they are actually links so it may be confusing a bit.
User avatar
tommy888
 
 
Posts: 214
Joined: Mon Sep 28, 2009 5:41 pm
Location: Poland
Contact:

Re: Extensionless URLs

Post 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.
Last edited by tommy888 on Wed Aug 05, 2015 9:52 pm, edited 1 time in total.
GerardF
 
 
Posts: 7
Joined: Mon Jan 05, 2015 11:38 am
Location: Amsterdam
Contact:

Re: Extensionless URLs

Post 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.
User avatar
vijayaraghavan.r
 
 
Posts: 15
Joined: Mon Nov 01, 2010 4:51 pm

Re: Extensionless URLs

Post 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.
Post Reply