Page 1 of 1

.htaccess

Posted: Fri May 11, 2018 7:49 am
by RiaanN
Good day

I have recently installed the Yellow Pages script from PHPJabbers. On the following domain www.wb-sa.co.za and with the help of another WWB user protectourlands managed to integrate everything into an index.php file created with Wb14.

I must stress that everything is working and there is no issues regarding the integration part. The problem that I am having is something else, and by way of Google search narrowed it down to my .htaccess file on the server. That is of course possible that I may be mistaken.

My problem is:
When a user creates an account he must at some point supply his website URL in the following format http://www.demo.com. However, some people just enter www.demo.com (without the http://) part. Some systems would tell the user to either use the correct format or add the http:// by default, but the scrip that I am using does not cater for such an event.

This means that when you hover over the link in the listing the web browser will show that the link is pointing to http://wb-sa.co.za/www.demo.com instead of http://www.demo.com.

My Google research point me to a how to redirect non www to www searching and suggest I add the following PHP code to my .htaccess file https://stackoverflow.com/questions/120 ... n-htaccess

So I entered the following code:
# Redirect to www
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTPS}s on(s)|offs()
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [NE,L,R]

Unfortunately this does not seem to work.

To see the problem in action please follow the link and proceed to click on the www.google.com link that is there. http://www.wb-sa.co.za/index.php?contro ... nView&id=6

Does someone have any suggestions.

Regards

Riaan

Re: .htaccess

Posted: Fri May 11, 2018 8:28 pm
by crispy68
I clicked on the Google link and it worked just fine

Re: .htaccess

Posted: Fri May 11, 2018 10:25 pm
by RiaanN
Hi

Jip - But I had to go and fix it manually on the backend. PHPjabbers is going to send me a fix to force the users to either put http:// or https:// before typing www.

Currently it is possible to enter your website URL anyway you want to and I know that many people are going to take a shortcut and just put in www. and then it is not going to direct to their page

Regards


Riaan

Re: .htaccess

Posted: Fri May 11, 2018 10:42 pm
by crispy68
I own many of their scripts and they do a good job about customizing them for you or fixing bugs