fisharebest / webtrees

Online genealogy
https://webtrees.net
GNU General Public License v3.0
487 stars 301 forks source link

Seo friendly url's #1517

Closed JustCarmen closed 5 years ago

JustCarmen commented 6 years ago

I've noticed the introduction of routes which changes the urls of webtrees pages. Isn't this a good time to switch to SEO friendly urls? If not, are there any plans to implement this in the future?

fisharebest commented 6 years ago

If not, are there any plans to implement this in the future?

Yes - this is the plan.

I am planning to use Laravel, and you will see that the code is starting to look a little like https://laravel.com/docs/5.5/routing and https://laravel.com/docs/5.5/urls - with URLs generated by a route() function.

curtisdelicata commented 6 years ago

👍

curtisdelicata commented 6 years ago

I've successfully manually changed code to get pages such as individual.php working as SEO friendly URLs. I followed links and modified a few other pages.

However I'm thinking that if I changed all of the pages, it would all be changed again when you implement routing anyway?

Also, I hope you don't mind me asking how to use a clean URL for index.php? it keeps redirecting loop.

What is the status on Laravel routing?

fisharebest commented 6 years ago

However I'm thinking that if I changed all of the pages, it would all be changed again when you implement routing anyway?

That's inevitable

Also, I hope you don't mind me asking how to use a clean URL for index.php? it keeps redirecting loop.

index.php can show different content for each tree. e.g. index.php?ged=tree1 and index.php?ged=tree2.

index.php without any parameters will always redirect onto one of these canonical forms. Otherwise you have two different URLs with the same content - and search-engines will penalise you for this.

What is the status on Laravel routing?

I am currently rewriting the code to use a similar structure.

Laravel uses route(xxx, [params]) to generate xxx?params

webtrees is being modified to use route(xxx, [params]) to generate index.php?route=xxx&params

Once all URLs are generated using the same functions/helpers as laravel, we'll be able to easily make the transition.

curtisdelicata commented 6 years ago

Thank you for your reply.

I was trying to turn index.php?ged=tree&route=tree-page to tree/index/tree-page. Same as I do for individual

This is my .htaccess for reference:

RewriteEngine on RewriteCond %{HTTPS} off [OR] RewriteCond %{HTTP_HOST} !^www. [NC] RewriteRule (.*) https://www.domain.com%{REQUEST_URI} [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^(.?)/index /index.php?ged=$1 [NC,L] RewriteRule ^(.?)/index/(.?)$ /index.php?route=$2&ged=$1 [NC,L] RewriteRule ^(.?)/individual/(.?)$ /individual.php?pid=$2&ged=$1 [NC,L] RewriteRule ^(.?)/source/(.?)$ /source.php?sid=$2&ged=$1 [NC,L] RewriteRule ^(.?)/ancestry/(.*?)$ /ancestry.php?rootid=$2&ged=$1 [NC,L]

fisharebest commented 6 years ago

The redirect happens here:

You could remove this code:

https://github.com/fisharebest/webtrees/blob/1.7/index.php#L76-L81

curtisdelicata commented 6 years ago

I'm running from master which is 2.0? I did find RedirectResponse functions on other pages.

Trying to figure out best approach to turning your routes into friendly URLs?

curtisdelicata commented 6 years ago

Are you still planning on migrating to Laravel? I've been watching the project and the http controller approach I like.

I've decided to wait until the code is more stable on the module implementation before I begin work again as custom work kept breaking (which is not a problem ss stated above, the code does look improved since I last checked a few months ago and I do understand development is happening fast).

fisharebest commented 6 years ago

Are you still planning on migrating to Laravel?

Absolutely!

curtisdelicata commented 6 years ago

Would that be with making use of Vue? Or does that affect accessibility?

fisharebest commented 6 years ago

Would that be with making use of Vue?

I have no plans to use VueJS at this stage. I find that as soon as I learn a javascript framework, it goes out of fashion and gets replaced with another ;-)

Or does that affect accessibility?

We are using laravel/vuejs on my current project at work, and our accessibility testing team did not find any problems.

curtisdelicata commented 6 years ago

Thanks for clarifying as I'm also using laravel/vuejs based project and wasn't sure of accessibility.

fisharebest commented 5 years ago

Pretty URLs are now supported.

See https://webtrees.github.io/faq/urls