Page 1 of 1
.HTACCESS can it be run from a subfolder? How?
Posted: Wed May 16, 2012 4:43 am
by simonmlewis
[text]DirectoryIndex index.html index.htm index.php
order allow,deny
allow from all
Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteRule ^([^/\.]+)/?$ index.php?page=$1&menu=home [L]
RewriteRule ^$ index.php?page=home&menu=home [L][/text]
Trying to run this from within : httpdocs/beta/
It won't work as it's looking in the ROOT.
So what do I need to add to make this work in /beta/, so I can test it for the client.
I cannot test it in a subdomain just yet.
Re: .HTACCESS can it be run from a subfolder? How?
Posted: Wed May 16, 2012 4:54 am
by requinix
You don't have to do anything special. Are you sure that .htaccess files are allowed and being interpreted?
Re: .HTACCESS can it be run from a subfolder? How?
Posted: Wed May 16, 2012 6:05 am
by simonmlewis
Yes. But surely that HTACCESS script is looking from the ROOT? There is no mention of the 'beta' folder and I wouldn't know how to put that in globally in HTACCESS.
Re: .HTACCESS can it be run from a subfolder? How?
Posted: Wed May 16, 2012 9:55 pm
by requinix
It's not "looking" anywhere. If you put it in the beta/ subfolder then it will apply to the beta/ folder and everything underneath. That's how these files work.
Re: .HTACCESS can it be run from a subfolder? How?
Posted: Thu May 17, 2012 3:16 am
by simonmlewis
But do you then have to change the hyperlinks to /beta/contact, or can that be done in HTACCESS? As I have links that are /contact.
Re: .HTACCESS can it be run from a subfolder? How?
Posted: Thu May 17, 2012 11:02 am
by requinix
You'd have to change the links, but your .htaccess can't do that for you. The only thing it can do is rewrite (for example) /contact to /beta/contact but it will either (a) not let you use /beta URLs or (b) break your POSTed forms.
Typical solution is to define a site root somewhere like
and use that everywhere you construct a URL.
Re: .HTACCESS can it be run from a subfolder? How?
Posted: Mon Jul 16, 2012 6:50 am
by simonmlewis
I need to point a particular URL to show a full URL.
RewriteRule ^products/ /index.php?page=products&menu=home [L]
This is clearly wrong, but I need /products.... go to to index.php?page=home&menu=home.
How do I do the first bit??
Simon
Re: .HTACCESS can it be run from a subfolder? How?
Posted: Mon Jul 16, 2012 5:44 pm
by requinix
Both of those try to rewrite from /products. Can't do that. The URLs have to be different.
Where is just "/products" supposed to go? For the other one, what URL is supposed to go to that?
Re: .HTACCESS can it be run from a subfolder? How?
Posted: Tue Jul 17, 2012 3:57 am
by simonmlewis
This is the list so far.
RewriteRule ^portfolio/([^/]+) /index.php?page=applications&menu=$1 [L]
RewriteRule ^portfolio/([^/]+)/([^/]+)/([0-9]+) /index.php?page=applications&menu=$1&application=$1&appid=$2 [L]
RewriteRule ^appprods/([^/]+)/([^/]+) /index.php?page=appprods&menu=$1&app=$2 [L]
RewriteRule ^appprods/([^/]+)/([^/]+)/([0-9]+)/([0-9]+)/([^/]+) /index.php?page=products&menu=$1&application=$2&appid=$3&product=$4&h=$5 [L]
RewriteRule ^categ/([0-9]+)/([^/]+) /index.php?page=categ&catid=$1&category=$2&menu=categ [L]
RewriteRule ^categ/page/([0-9]+)/([^/]+)/([0-9]+) /index.php?page=categ&c=$1&cname=$2&menu=categ&pagenum=$3 [L]
RewriteRule ^product/([0-9]+)/([^/]+)/([0-9]+)/([^/]+) /index.php?page=product&catid=$1&category=$2&menu=categ&product=$3&h=$4 [L]
THIS is the one I am trying to sort out. Have tried just putting in any word after, that takes them to menu=categ.
RewriteRule ^products/([^/]+) /index.php?page=products&menu=categ [L]
RewriteRule ^([^/\.]+)/?$ index.php?page=$1 [L]
RewriteRule ^$ index.php?page=home [L]
Re: .HTACCESS can it be run from a subfolder? How?
Posted: Mon Jul 23, 2012 9:59 am
by simonmlewis
Code: Select all
RewriteRule ^solutions/([^/]+) /index.php?page=solutions&menu=$1 [L]
RewriteRule ^solutions/sol/([^/]+) /index.php?page=$1&menu=sol [L]
This isn't working now.
The top one works. ..../solutions/sol, will take the user to index.php?page=solutions&menu=sol.
But ..../solutions/sol/sol_yachts just takes them back to the solutions/sol above.
Why is that?