Ultimate SEO Urls

Replace .html extension - Ultimate SEO Urls

Replace .html extension

by alix32 » Mon May 10, 2021 12:40 pm

Hi - I was using the old Ultimate SEO URL addon, but moving over to Phoenix V1.0.8.0 with this addon.
With my old USU version I had removed the .html extension with a "/".
So instead of having:
www.mysite.com/my-great-product-p-47.html
I have:
www.mysite.com/my-great-product-p-47/

I have thousands of indexed urls with that format and it would probably take ages for Google to index my newly formatted urls.

How can we replace .html with "/" ? I use the "rewrite" uri format, and I thought it would have been as easy as changing this line below \includes\apps\ultimate_seo_urls\uri_modules\rewrite.php

Code: Select all

    public function createLinkString( $page, $text, $seperator, $value ) {
      return usu_multi_language( $separator = 'right' ) . $text . $seperator . $value . '.html';
to

Code: Select all

    public function createLinkString( $page, $text, $seperator, $value ) {
      return usu_multi_language( $separator = 'right' ) . $text . $seperator . $value . '.html';
but while the rewrite works (I get the correct url in the address bar), I get a 404 Not Found page.

What else should I be changing? Thanks!
Current Phoenix Version in prod: 1.0.7.6
User avatar
alix32
Posts: 13
Joined: Mon Oct 26, 2020 11:22 am
Contact:

Re: Replace .html extension

by raiwa » Tue May 11, 2021 1:42 pm

Seems your second snippet is identical to the first? Wrong pasted?
You’ll have to modify also the redirect rules in .htaccess
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27
raiwa
PhoenixCart Developer
PhoenixCart Developer
Posts: 1184
Joined: Sat Dec 21, 2019 8:08 am
Contact:

Re: Replace .html extension

by alix32 » Tue May 11, 2021 3:33 pm

Hi Raiwa and thanks for the catch, indeed wrong paste. So I just achieved what I wanted by changing in the \includes\apps\ultimate_seo_urls\uri_modules\rewrite.php file, this:

Code: Select all

 public function createLinkString( $page, $text, $seperator, $value ) {
      return usu_multi_language( $separator = 'right' ) . $text . $seperator . $value . '.html';
to:

Code: Select all

 public function createLinkString( $page, $text, $seperator, $value ) {
      return usu_multi_language( $separator = 'right' ) . $text . $seperator . $value . '/';
And then in the htaccess file, changed this:

Code: Select all

## BEGIN USU URL rewrite rules ##
## USU Version: 3.0.2 ##
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteRule ^([a-z0-9/-]+)-c-([0-9_]+).html$ index.php [NC,L,QSA]
  RewriteRule ^([a-z0-9/-]+)-m-([0-9]+).html$ index.php [NC,L,QSA]
  RewriteRule ^([a-z0-9/-]+)-p-([0-9]+).html$ product_info.php [NC,L,QSA]
  RewriteRule ^([a-z0-9/-]+)-pi-([0-9]+).html$ info.php [NC,L,QSA]
to this:

Code: Select all

## BEGIN USU URL rewrite rules ##
## USU Version: 3.0.2 ##
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteRule ^([a-z0-9/-]+)-c-([0-9_]+)/$ index.php [NC,L,QSA]
  RewriteRule ^([a-z0-9/-]+)-m-([0-9]+)/$ index.php [NC,L,QSA]
  RewriteRule ^([a-z0-9/-]+)-p-([0-9]+)/$ product_info.php [NC,L,QSA]
  RewriteRule ^([a-z0-9/-]+)-pi-([0-9]+)/$ info.php [NC,L,QSA]
Many thanks!
Current Phoenix Version in prod: 1.0.7.6
User avatar
alix32
Posts: 13
Joined: Mon Oct 26, 2020 11:22 am
Contact: