Hoping it is just a simple fix

This section is for posting questions which are not directly related to WYSIWYG Web Builder.
Examples of off topics: web server configuration, hosting, programming related questions, third party scripts.

Note that these questions will generally not be answered by the administrators of this forum.
Post Reply
Martin555
 
 
Posts: 26
Joined: Sun Jun 14, 2020 9:09 am

Hoping it is just a simple fix

Post by Martin555 »

Hi good people,

I have run into a small problem with my site and that is I currently cannot update my www.example.com home page. I can only update www.example.com/index

It seems that I have two separate pages one being .com and the other .com/index and I cannot update the .com page anymore.

I know it is me who has done something as I was playing around in htaccess files, which I will paste here.

So when I go to example.com live after uploading the page, which is index in my program it is not updated, only if I type in example.com/index will it show the updated page live.

Here are my current htaccess files >>

RewriteEngine On


RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*)$ /$1.html [L]


<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>

# BEGIN Expire headers
<ifModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 5 seconds"
ExpiresByType image/x-icon "access plus 2592000 seconds"
ExpiresByType image/jpeg "access plus 2592000 seconds"
ExpiresByType image/png "access plus 2592000 seconds"
ExpiresByType image/gif "access plus 2592000 seconds"
ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
ExpiresByType text/css "access plus 604800 seconds"
ExpiresByType text/javascript "access plus 216000 seconds"
ExpiresByType application/javascript "access plus 216000 seconds"
ExpiresByType application/x-javascript "access plus 216000 seconds"
ExpiresByType text/html "access plus 600 seconds"
ExpiresByType application/xhtml+xml "access plus 600 seconds"
</ifModule>
# END Expire headers

# BEGIN Cache-Control Headers
<ifModule mod_headers.c>
<filesMatch "\.(ico|jpe?g|png|gif|swf)$">
Header set Cache-Control "public"
</filesMatch>
<filesMatch "\.(css)$">
Header set Cache-Control "public"
</filesMatch>
<filesMatch "\.(js)$">
Header set Cache-Control "private"
</filesMatch>
<filesMatch "\.(x?html?|php)$">
Header set Cache-Control "private, must-revalidate"
</filesMatch>
</ifModule>
# END Cache-Control Headers

ErrorDocument 500 https://www.example.com/404.php ( I have purposely changed that back to "example")

ErrorDocument 404 https://www.example.com/404.php

The reason why I was playing around with this, is because I wanted my .com/index web traffic going to .com and I was trying to redirect it. The 500 and 404 pages are necessary as some of my pages do not exist anymore, which can still be found on Google and the like. I have requested that they be moved, Google is quick others not so.

Big thanks as ever,

Martin.
wwonderfull
 
 
Posts: 1255
Joined: Fri Aug 21, 2020 8:27 am

Re: Hoping it is just a simple fix

Post by wwonderfull »

Are you wanting example.com/index to become just example.com? 1st things 1st you might have to delete any code in htaccess which may be causing the problem. Also might have to remove the /index page from google and keep only the canonical one which should be example.com
Martin555
 
 
Posts: 26
Joined: Sun Jun 14, 2020 9:09 am

Re: Hoping it is just a simple fix

Post by Martin555 »

Hi wwonderful

Thank you for your prompt reply.

I originally wanted to do that, but now I just want to be able to update the .com page and not just the .com/index page.

I have deleted some code that was causing some problems, but then others occur like for example, if I take out all of the code, the page loads up without index but then all the links are 404 and not directed either.

If I delete just this bit of code >

RewriteCond %{THE_REQUEST} \ /(.*)\.html($|\ )
RewriteRule ^ /%1 [L,R=301]

It shows the webpage without /index but it is not updated. The links work but they take you to the old page links and not the updated. I have fully published the website three times, but still does not update the new links.

If I delete just this bit of code >

RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*)$ /$1.html [L]

The page uploads without the /index and is updated, but most of the links are not working either 404 error.

If I delete both sets of code, I have the same result as first, the webpages load up but they are old links and the page is not updated, even though both pages do not have /index at the end of the url.

If I leave them both in place then the website loads up OK, but the links in the .com page have not been updated, when I inspect them on Google Chrome it is still pointing to the old URL even though I have updated the homepage, but the .com/index

It seems to me if I can somehow work out what I have done and can update and upload the webpage without the /index prefix with the links then I should be good to go.

Let me know your thoughts,

Thank you once again
Martin555
 
 
Posts: 26
Joined: Sun Jun 14, 2020 9:09 am

Re: Hoping it is just a simple fix

Post by Martin555 »

I just figured out what I have done wrong.

I have in my CPanel File Manager, four different uploads of the same homepage, .html, index.html, -.html and home.html and I had not updated the .html page only the index page.

So I simply deleted all the pages but .html

Stupid, yep I know, but you learn as you go.

Thank you
Last edited by Martin555 on Wed Aug 10, 2022 5:08 am, edited 1 time in total.
wwonderfull
 
 
Posts: 1255
Joined: Fri Aug 21, 2020 8:27 am

Re: Hoping it is just a simple fix

Post by wwonderfull »

When we did the building of our website I had to be extra cautious in terms of how to configure the .htaccess. Most important part is if anything gets published in the search engines there will be consequences for that also. I had pages which had .html and .php extensions also published which I wanted to remove and did so. All in all everything is now in perfect shape with the perfect settings.

Setting the .htaccess to remove the extensions such as index or html or php is one thing and you also have to set the canonical url for your website which is also a must, along with that you have to enable the advanced option in wwb publishe> Hide file extensions for internal links settings for wwb to generate some code or settings based on that. All this things the results are what you want and most importantly what Google and other search engines want and that is a canonical page with no extensions. But if you want the html and php extensions to show that's your wish read help to know more.

To get the proper solution I would advice to do it from the start an empty htaccess (keep a backup of the previous) file and from wwb put the canonical page url on meta tag. After that start working with the advanced options enabled and then the server sided thing which is htaccess.

If you still get any problem let us know.
Martin555
 
 
Posts: 26
Joined: Sun Jun 14, 2020 9:09 am

Re: Hoping it is just a simple fix

Post by Martin555 »

Hi wwonderful,

Thank you very much for taking the time to reply at length and give me some very good pointers on what I need to do.

I will listen and take everything you said on board including setting up a canonical url,

I appreciate all the advice

Martin
Post Reply