Page 1 of 1

New Host URL problem- can HTACCESS help?

Posted: Fri Jan 30, 2015 5:51 am
by simonmlewis
Hi
We are now using a new host for a web site, but until we are happy it's running we need to test it.
It's using cPanel, and has it in the following format for testing:

http://33.33.33.33/simondomain_/

(obviously this is not genuine).

If I load up http://33.33.33.33/simondomain_/images/logo.png
It works. but if I load up:
http://33.33.33.33/simondomain_/
Which should in theory bring the homepage up, it fails, because.... of the simondomain_ part.
So is there something I can put at the top of the HTACCESS file, temporary, to test this domain works for us? something that includes that part of the URL so the rest of it works.

Re: New Host URL problem- can HTACCESS help?

Posted: Fri Jan 30, 2015 6:15 am
by Celauran
How does it fail? 404? 401? Are they any .htaccess rules already in place for the index page?

Re: New Host URL problem- can HTACCESS help?

Posted: Fri Jan 30, 2015 6:21 am
by simonmlewis
404 not found, on a blue screen.

HTACCESS is just the general stuff.

Code: Select all

DirectoryIndex index.php index.html index.htm
order allow,deny
allow from all 

Options +FollowSymLinks
Options +Indexes
RewriteEngine On

RewriteRule ^error/?$  /selectpage [QSA]

RewriteRule ^(blog)($|/) - [QSA]

RewriteRule ^categ/([0-9]+)/([^/]+) /index.php?page=categ&c=$1&cname=$2&menu=sub [QSA]
RewriteRule ^categ/page/([0-9]+)/([^/]+)/([0-9]+) /index.php?page=categ&c=$1&cname=$2&menu=sub&pagenum=$3 [QSA]
RewriteRule ^subcateg/([0-9]+)/([^/]+)/([0-9]+)/([^/]+) /index.php?page=subcateg&c=$1&cname=$2&s=$3&sname=$4&menu=sub [QSA]
RewriteRule ^subcateg/page/([0-9]+)/([^/]+)/([0-9]+)/([^/]+)/([0-9]+) /index.php?page=subcateg&c=$1&cname=$2&s=$3&sname=$4&menu=sub&pagenum=$5 [QSA]

RewriteRule ^product/([0-9]+)/([^/]+)/([0-9]+)/([^/]+)/([0-9]+)/([^/]+) /index.php?page=product&c=$1&cname=$2&s=$3&sname=$4&menu=sub&product=$5&h=$6 [QSA]
RewriteRule ^product/([0-9]+)/([^/]+)/([0-9]+)/([^/]+)/([0-9]+) /index.php?page=product&c=$1&cname=$2&s=$3&sname=$4&menu=sub&product=$5 [QSA]

RewriteRule ^([^/\.]+)/?$ index.php?page=$1 [QSA]

RewriteRule ^$ index.php?page=home [QSA]

Re: New Host URL problem- can HTACCESS help?

Posted: Fri Jan 30, 2015 6:34 am
by Celauran
The resource that worked was a static asset. Do any pages work? Is it just index.php that's the problem? What if you disable .htaccess?

Re: New Host URL problem- can HTACCESS help?

Posted: Fri Jan 30, 2015 6:49 am
by simonmlewis
the problem is, all the images and css files are in /images/* or /source/*, so it's looking for them in the root, and go back beyond the simondomain_ area.

If I run index.php alone, text shows, no formatting, no images.

Re: New Host URL problem- can HTACCESS help?

Posted: Fri Jan 30, 2015 6:58 am
by Celauran
That's actually good news. It means everything on the server appears to be configured properly. You'll need to add a RewriteBase to your .htaccess, but your redirects should then work. If your static assets are referencing an absolute path, understandably they're going to fail.

Re: New Host URL problem- can HTACCESS help?

Posted: Fri Jan 30, 2015 7:04 am
by simonmlewis
You'll need to add a RewriteBase to your .htaccess,
That is precisely it. There are no absolute references, but I understand the comment.
So what do I need to add to htaccess to make this work?

Re: New Host URL problem- can HTACCESS help?

Posted: Fri Jan 30, 2015 7:41 am
by Celauran
[text]RewriteBase /simondomain_/[/text]

Re: New Host URL problem- can HTACCESS help?

Posted: Fri Jan 30, 2015 7:52 am
by simonmlewis
In this order?

DirectoryIndex index.php index.html index.htm
order allow,deny
allow from all

Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteBase /simondomain_/

Re: New Host URL problem- can HTACCESS help?

Posted: Sat Jan 31, 2015 6:51 am
by Celauran
Have you tried? Is it working?