Welcome Guest. Please Login or Register  


You are here: Index > SitePad Website Builder > General Support > Topic : Why does sitepad add redirect to /



Threaded Mode | Print  

 Why does sitepad add redirect to /, every page is redirected to trailing / (0 Replies, Read 167 times)
sales@topweb.wales
Group: Member
Post Group: Newbie
Posts: 10
Status:
Hi,

I'd like to use in htaccess to force www and https without trailing / on files

To follow correct convention Url's should appear like:
https://www.website-hosting.company/

https://www.website-hosting.company/services

Code
# Turn on Rewrite Engine
RewriteEngine On

# Remove trailing slash from non-filepath urls
RewriteCond %{REQUEST_URI} /(.+)/$
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ https://www.website-hosting.company/%1 [R=301,L]

# Include trailing slash on directory
RewriteCond %{REQUEST_URI} !(.+)/$
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+)$ https://www.website-hosting.company/$1/ [R=301,L]

# Force HTTPS and WWW
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [OR,NC]
RewriteCond %{HTTPS} off 
RewriteRule ^(.*)$ https://www.website-hosting.company/$1 [R=301,L]


BUT

Sitepad forces it's own redirect to add a trailing / to all url's and this causes a loop as I try to remove the trailing / from /services  /contact etc

See the result here :

Code
>>> http://website-hosting.company/services

> --------------------------------------------
> 301 Moved Permanently
> --------------------------------------------

Status:    301 Moved Permanently
Code:    301
Date:    Sun, 22 Nov 2020 12:24:38 GMT
Server:    Apache/2.4.29 (Ubuntu)
Location:    https://www.website-hosting.company/services
Content-Length:    341
Connection:    close
Content-Type:    text/html; charset=iso-8859-1




>>> https://www.website-hosting.company/services

> --------------------------------------------
> 301 Moved Permanently
> --------------------------------------------

Status:    301 Moved Permanently
Code:    301
Date:    Sun, 22 Nov 2020 12:24:38 GMT
Server:    Apache/2.4.29 (Ubuntu)
X-Redirect-By:    SitePad
Strict-Transport-Security:    max-age=31536000; preload
Location:    https://www.website-hosting.company/services/
Cache-Control:    s-maxage=10
Content-Length:    0
Connection:    close
Content-Type:    text/html; charset=UTF-8




>>> https://www.website-hosting.company/services/

> --------------------------------------------
> 200 OK


the second redirect is not necessary.
IP: --   

« Previous    Next »

Threaded Mode | Print  



Jump To :


Users viewing this topic
1 guests, 0 users.


All times are GMT. The time now is December 3, 2020, 11:37 pm.

  Powered By AEF 1.0.8 © 2007-2008 Electron Inc.Queries: 11  |  Page Created In:0.102