Hiding page name following site URL

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
User avatar
alex4orly
 
 
Posts: 632
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: Hiding page name following site URL

Post by alex4orly »

Hello again,

Yes, uploaded it as ASCII
Yes, .htaccess is visible
Yes, the Host company assured me it is supported
Yes, it is in the folder where I need it to do it
Yes, changed the permissions to 755

The host company send me a link to Stackoverflow to search for information

But - no luck...
Any other reason you can think of?
User avatar
BaconFries
 
 
Posts: 5316
Joined: Thu Aug 16, 2007 7:32 pm

Re: Hiding page name following site URL

Post by BaconFries »

Yes, the Host company assured me it is supported
Yes, they may support it but is it enabled by them? It needs to be enabled in the web server's main configuration file. I would contact them again and ask them have they enabled it in <Directory></Directory> and it's directives by changing "AllowOverride None" to "AllowOverride All' ( minus the quotes) when done the .htaccess should be working.
Now on this
The host company send me a link to Stackoverflow to search for information
:shock: sorry for the shock but they should know how to set this as it is a web server configuration with them and for them to give you a link to search and find answers yourself is laughable (not at you but them) when it is really for them to help.
User avatar
Rob
 
 
Posts: 175
Joined: Sun Jan 29, 2012 2:54 pm
Location: MN
Contact:

Re: Hiding page name following site URL

Post by Rob »

BaconFries - Request permission to add a question (or rephrase the existing question)

Here is a link I found - https://www.rapidtables.com/web/tools/r ... rator.html. Thoughts on it's accuracy?

​For a permanent 301 redirect solution on a Linux platform with GoDaddy, which is a better solution in your opinion?

​htaccess:

# Permanent URL redirect - generated by www.rapidtables.com
Redirect 301 /about.html http://www.myurl.com/about/

or php:

<?php
// PHP permanent URL redirect - generated by www.rapidtables.com
header("Location: http://www.myurl.com/about/", true, 301);
exit();
?>

​This is for a simple redirect from about.html to about/ without a change in domain name or host. 

The following would be added to the htaccess file to hide the page extensions (from the WB12 program in options):

PHP EXTENTION REMOVAL
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
 
HTML EXTENTION REMOVAL
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]

​I assume this is correct? 
The Website Guy - MN
Small Business Web Design
User avatar
BaconFries
 
 
Posts: 5316
Joined: Thu Aug 16, 2007 7:32 pm

Re: Hiding page name following site URL

Post by BaconFries »

Hi Rob no permissions needed 😀 at all fire away. Both are just as good as each other and they do the same in the end. The PHP does requires the page extension to be .php were you can just add the .htaccess to the original file (if you already have one) and that's it.
The following would be added to the htaccess file to hide the page extensions (from the WB12 program in options):
Yes, you can also add further to it like the redirect, block allow IP address, Prevent Directory Listing, Block bots rven password it etc. With this said your host should support Apache and at the same time it needs to be enabled for it to work.
User avatar
Rob
 
 
Posts: 175
Joined: Sun Jan 29, 2012 2:54 pm
Location: MN
Contact:

Re: Hiding page name following site URL

Post by Rob »

Ok. I was also given this code to put in the htaccess file:

RewriteEngine On
RewriteBase /
RewriteRule ^/about/ /about.html
Redirect 301 /about.html /about/

Seems everyone (each "generator") has a different way to accomplishing this. Thoughts on the best way?

Also, if I am using redirects from nonwww to www as well as index.html to main url, is there a particular order all of this needs to be in?

I'll have to add in redirect from http to https another time...

In the end, I am simply wanting to learn how to 1 - hide page extensions (for security purposes right?) and 2 - ensure that if someone clicks on about.html in the search results they are successfully directing to the right page for about/. Wasn't there a big debate here on how best to accomplish this?

Thank you for the info. I'll have to call the host to ask if apache is supported and if "hide page extensions" is supported on my hosting plan.
The Website Guy - MN
Small Business Web Design
User avatar
alex4orly
 
 
Posts: 632
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: Hiding page name following site URL

Post by alex4orly »

Baconfries,

Following your comments above, I contacted again my host company and they pointed me to conduct the tests listed in the following link:
https://docs.bolt.cm/3.4/howto/making-s ... is-working
I conducted the test, all seems fine so they concluded that the problem must be in my .htaccess script itself - which is outside the scope of their support.
Please remember - I am NOT looking for a redirect - just to have the original website showing in the search bar, without the actual pages...
Interestingly, this is exactly how it looks on my Samsung Galaxy phone (Android)... How do they do it?

Cheers
Alex
User avatar
BaconFries
 
 
Posts: 5316
Joined: Thu Aug 16, 2007 7:32 pm

Re: Hiding page name following site URL

Post by BaconFries »

Hi Alex, I know that you are not looking for a redirect that answer was to Rob and not yourself.
Now in some instances you may need to use add "multiviews" to the .htaccess if this is the case then add the following to the top of the .htaccess

Code: Select all

Options +MultiViews


Example:

Code: Select all

<IfModule mod_rewrite.c>
Options -Multiviews
RewriteEngine on 
RewriteBase / 
RewriteRule ^(.+)\.html$ /$1 [R,L] 
RewriteCond %{REQUEST_FILENAME}.html -f 
RewriteRule ^(.*?)/?$ /$1.html [NC,END]
</IfModule>


And for the removal of the page name and extension try.

Code: Select all

<IfModule mod_rewrite.c>
Options -Multiviews
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*) index.php?$1 [L]
</IfModule>
User avatar
alex4orly
 
 
Posts: 632
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: Hiding page name following site URL

Post by alex4orly »

Thaks man,
Not clear - do I need the TWO script segments to be in the .htaccess file ?

<IfModule mod_rewrite.c>
Options -Multiviews
RewriteEngine on
RewriteBase /
RewriteRule ^(.+)\.html$ /$1 [R,L]
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*?)/?$ /$1.html [NC,END]
</IfModule>

AND

<IfModule mod_rewrite.c>
Options -Multiviews
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*) index.php?$1 [L]
</IfModule>
User avatar
BaconFries
 
 
Posts: 5316
Joined: Thu Aug 16, 2007 7:32 pm

Re: Hiding page name following site URL

Post by BaconFries »

No, please simply try each one to see what suits your needs and whatever works use. I don't know who you use for hosting but to be saying to you the customer "it is outside the scope of their support" I would be asking what do you support then as it is s server configuration and do you support this or not!. Right I am going to try and beat the a** out of Mr Insomnia to hopefully get some sleep.
User avatar
alex4orly
 
 
Posts: 632
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: Hiding page name following site URL

Post by alex4orly »

Dear friend, I much appreciate your continous help

I tried the first segment and got the following error. The 2nd segment, I didn't try becasue it only refers to PHP

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@beleuramyhome.org.au and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
Post Reply