Notifications
Clear all

removing index.php from URLs

5 Posts
2 Users
0 Reactions
1,105 Views
(@catharsis)
Posts: 9
Active Member
Topic starter
 

My goal is to never have index.php visible in the URL and it's mostly working but there's some room for improvement

I have Enable SEO Urls on but I had to do some additional rule tweaking:

RewriteBase /testgallery/
RewriteRule ^(.*)twg_album/(.*)$  $1?twg_album=$2 [L]
RewriteRule ^(.*)twg_image/(.*)/(.*)$  $1?twg_album=$2&twg_show=$3 [L] 
RewriteRule ^(.*)twg_show/(.*)$  $1?twg_album=&twg_show=$2 [L]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^index.php$ /testgallery/ [L,R=301,QSD]
RewriteRule ^index.php$ /testgallery/ [L,R=301]

Things that are not ideal:

1. Many of the internal hyperlinks point to "/testgallery/index.php" or "/testgallery/index.php?" which I've accounted for via redirects however it would be better if the hyperlinks simply pointed to "/testgallery/" to begin with so I didn't have to bounce them through a redirect. What would be the best way to accomplish this?

2. Some of the canonicals are like "link rel="canonical" href="/testgallery/index.php""... I would prefer them to just be /testgallery/ without the index.php.  What would be the best way to accomplish this?

 

 
Posted : 14/05/2021 4:44 pm
TinyWebGallery
(@admin)
Posts: 925
Prominent Member Admin
 

Hi,

I think both are not using my method where seo urls are generated. I basically have my normal urls and if seo is enabled this method does then rewrite them.

I think e.g. for the menu and also for the canonical this needs also to be done.

I think the menu and the canonical parts are in 2 files only. So changing them should not be a big problem. You still have to find them all ;).

Best regards, Michael

 
Posted : 14/05/2021 5:39 pm
TinyWebGallery
(@admin)
Posts: 925
Prominent Member Admin
 

I just checked the canonical

There tfu_seo_rewrite_url is used. can you give me an example where it is not rendered properly?

If you set

$enable_basic_seo=true;

 

is should be rendered.

 

 
Posted : 14/05/2021 5:48 pm
TinyWebGallery
(@admin)
Posts: 925
Prominent Member Admin
 

o.k. found it in tfu_seo_rewrite_url  seo urls are only generated when parameters are attached. Not if nothing is there.

I can update this in the next version. 2.5.

Best regards, Michael

 
Posted : 14/05/2021 6:09 pm
TinyWebGallery
(@admin)
Posts: 925
Prominent Member Admin
 

Please check TWG 2.5. I have added some improvements there.

Best regards, Michael

 
Posted : 17/05/2021 5:12 pm