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

Hiding page name following site URL

Post by alex4orly » Sun Dec 03, 2017 7:34 pm

Hello folks,
I have several websites that are made with RWD in mind, for example here : http://www.nmaa-rc.org.au
But once the site loads, the visitor can see the actual page name he / she is on - in this case it is "frontpage.html"
I have one site, that has not yet been converted to be based on RWD here : http://www.semac.org.au/ which doesn't show the pages.

How can I avoid showing the pages?

The main reason for this, is that I want to implement Login / password control and visitors will know the page name that loads after the login dialog and circumvent it by going directly to it...

Any suggestions?

User avatar
Pablo
 
Posts: 19658
Joined: Tue Mar 28, 2006 12:00 pm
Location: Europe
Contact:

Re: Hiding page name following site URL

Post by Pablo » Sun Dec 03, 2017 8:59 pm

This has nothing to do with RWD.
The pages are displayed in an inline frame, so that is why the URL is not updated.

User avatar
alex4orly
 
 
Posts: 564
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: Hiding page name following site URL

Post by alex4orly » Sun Dec 03, 2017 9:05 pm

Ok, is there a way for me to hide the page names from showing up on all my other sites?

User avatar
BaconFries
 
 
Posts: 4491
Joined: Thu Aug 16, 2007 7:32 pm

Re: Hiding page name following site URL

Post by BaconFries » Sun Dec 03, 2017 10:53 pm

If you are not going to be calling the pages in a iframe (inline Frame) like you have shown, then you can hide the file extension ie .index.html etc by using a . htaccess for this. And if the page (s) are protected then the user/visitor won't or shouldn't be accessible unless they login.

User avatar
alex4orly
 
 
Posts: 564
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: Hiding page name following site URL

Post by alex4orly » Mon Dec 04, 2017 12:39 am

Hello again,

1) Never touched . htaccess
2) What does it mean my pages are protected

Can you please elaborate with an example?

Thaks

User avatar
BaconFries
 
 
Posts: 4491
Joined: Thu Aug 16, 2007 7:32 pm

Re: Hiding page name following site URL

Post by BaconFries » Mon Dec 04, 2017 2:50 am

1) Never touched . htaccess
A .htaccess is really just a text file to create simply open note pad and paste the following

Code: Select all

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html[NC,L] 
to save -> Save As -> Write .htaccess and choose "All Files" as the type - this will then create the .htaccess file for you now upload to your host. Note your host/server must support Apache.

Image
2) What does it mean my pages are protected
It means are they protected! can I for instance access the page without having to login? If I know the url can I just type this in the address bar and enter? If the page is protected ie the Page Protect Object then I shouldn't be able to access without logging in first with credentials. You can read more at the following:
Step 4 - Protecting a page
Adding a login to your web site Note Alex you have asked about Page Protection before.
See the following this is a little programme made by a member.
Extensionless URLs

User avatar
alex4orly
 
 
Posts: 564
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: Hiding page name following site URL

Post by alex4orly » Mon Dec 04, 2017 5:40 am

Hi Baconfries,

Seems a bit of missunderstanding here. What I want is that:
1) Visitors that know the page names of the website, may be able to circumvent the Passowrd / login dialog and access those pages directly.
2) To prevent this, I want to hide the page names, so whatever page the visitor visits - the URL will remain the original URL : http://www.beleuramyhome.org.au/ whereas now it shows the pagename.html on the continuation.
3) I thought that maybe there is a way of making an entry (What?) into .htaccess to prevent this from showing.
Yes, I did ask about page protection, but I have no intention to implement such a feature - this will be a duplicate to implementing a global login page on initial entry to the site.

If there is a way to fix this in .htaccess, please help me with that

Thanks again

User avatar
BaconFries
 
 
Posts: 4491
Joined: Thu Aug 16, 2007 7:32 pm

Re: Hiding page name following site URL

Post by BaconFries » Mon Dec 04, 2017 12:28 pm

By inserting the following into your .htaccess file this will then remove all of the file extension(s) that end in .html including the page name(s) as in this example pagename.html If you carefully look at the code below you will see that it is using .html. When on the server it will know to remove this from all pages that use .html Please note that this is a server configuration that your host can offer support on.

Code: Select all

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html[NC,L] 

User avatar
alex4orly
 
 
Posts: 564
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: Hiding page name following site URL

Post by alex4orly » Mon Dec 04, 2017 7:31 pm

OK, so let me see if I understand

1) For each page I want to hide, I need to insert those 2 lines ? or the first line is required only once followed by a list of several pages???
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html[NC,L]

2) As per the above example, in my case (frontpage.html) it will be
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $frontpage.html[NC,L]

3) Does it matter where in the .htaccess file the lines are inserted
4) Is it also possible to hide pages if they are of type PHP files

Thanks again

User avatar
BaconFries
 
 
Posts: 4491
Joined: Thu Aug 16, 2007 7:32 pm

Re: Hiding page name following site URL

Post by BaconFries » Mon Dec 04, 2017 9:21 pm

1) For each page I want to hide, I need to insert those 2 lines ? or the first line is required only once followed by a list of several pages???
No, you only need one .htaccess file this will cover all pages!
2) As per the above example, in my case (frontpage.html) it will be
No, you only need the extension (.html, .htm, .php) nothing else the server does the rest and removes the name plus the extension!.
3) Does it matter where in the .htaccess file the lines are inserted
If you are using other references in a . htaccess already then I would place at the start.

Code: Select all

<IfModule mod_rewrite.c>
RewriteEngine on
in your .htaccess place here
</IfModule>
4) Is it also possible to hide pages if they are of type PHP files
Yes, you can see the following

Code: Select all

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php
#RewriteRule ^([a-z]+)\/?$ $1.php [NC]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*)$ $1.html
#RewriteRule ^([a-z]+)\/?$ $1.html [NC]

User avatar
alex4orly
 
 
Posts: 564
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: Hiding page name following site URL

Post by alex4orly » Mon Dec 04, 2017 9:47 pm

Thanks again,
Now the big question is - if my host platform supports this
Cheer

User avatar
alex4orly
 
 
Posts: 564
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: Hiding page name following site URL

Post by alex4orly » Mon Dec 04, 2017 10:36 pm

Not working... Please visit : http://www.beleuramyhome.org.au/ - all the page names are showing on th eURL
The content of my .htaccess is below, as copied from your instructions...
What am I doing wrong???

I placed .htaccess file into the root of the site, should I place it into the public_html folder instead, where the actual site pages are loaded into? ?

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php
#RewriteRule ^([a-z]+)\/?$ $1.php [NC]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*)$ $1.html
#RewriteRule ^([a-z]+)\/?$ $1.html [NC]
</IfModule>

User avatar
BaconFries
 
 
Posts: 4491
Joined: Thu Aug 16, 2007 7:32 pm

Re: Hiding page name following site URL

Post by BaconFries » Tue Dec 05, 2017 2:30 am

Does your host support Apache? Have you named the htaccess just .htaccess with no other extensions such as maybe
.htaccess.txt? Note I am in the UK so there is a time difference and I am turning in now so won't read/reply till the afternoon.

User avatar
alex4orly
 
 
Posts: 564
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: Hiding page name following site URL

Post by alex4orly » Tue Dec 05, 2017 2:36 am

Yes, I know where you are
Yes, the filename is exactly that
Yes, the host company is supporting it
Is the content correct?

Go to sleep

User avatar
BaconFries
 
 
Posts: 4491
Joined: Thu Aug 16, 2007 7:32 pm

Re: Hiding page name following site URL

Post by BaconFries » Tue Dec 05, 2017 2:32 pm

Yes from looking at what I gave you to use it looks ok. When you uploaded the .htaccess you need to ensure optimal the file is in 'ASCII' mode and not 'BINARY' many FTP software programs use 'BINARY' as default so this may be the issue if it wasn't the correct format.
Does it appear in your file listings? have you uploaded it to the directory you wish it to take effect on? you can check this by using your web browser to see that it has worked. If it doesn't show then that is fine it just means the server is hiding it or your 'FTP' is.
Have set permissions to the file correctly? if not try setting to '755' or 'executable' this can be done using 'File Permissions' or using 'CHMOD' entering ' 0755'. If after this it still doesn't work contact your host asking if .htaccess is enabled as many do not use and if not enabled can they do so.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests