Forum Moderators: phranque
My goal is process URLs like:
siteType.domain.com/subSiteName
siteType.domain.com/subSiteName/view/doc/123
Ex:
community.domain.com/programmers/view/doc/123 (without index.php)
business.domain.com/superFish/list/doc/456 (without index.php)
Until now I used URLs like :
siteType.domain.com/index.php/view/doc/123
The code that follow is explained inself and I use it to have $_GET properly
...
define('LOADER', '/index.php');
...if ($_SERVER['REQUEST_METHOD'] == 'GET')
{
# make $_GET to hand
if (!strstr($_SERVER['REQUEST_URI'], LOADER . '?'))
{
$_get = explode('/', $_SERVER['REQUEST_URI']);
$deep = count($_get);
for ($i = 2; $i < $deep - 1; $i++)
{
$_GET[$_get[$i]] = $_get[++$i];
}
if (!strstr($_SERVER['REQUEST_URI'], LOADER))
{
$_SERVER['REQUEST_URI'] = LOADER."/main/main";
}
}
else
{
$_request_uri = '';
$_get = strtok($_SERVER['REQUEST_URI'], '?');
$_get = strtok('');
$_get = explode('&', $_get);
foreach ($_get as $i => $_get2)
{
$_get2 = explode('=', $_get2);
$_GET[$_get2[0]] = $_get2[1];
$_request_uri .= "/{$_get2[0]}/{$_get2[1]}";
}
$_SERVER['REQUEST_URI'] = LOADER."/$_request_uri";
}
}
Now, how can I do all this with htaccess? :o
1) avoid URLs with?, &, =
2) using subdomains
3) without index.php
How can I redirect any fileName without php extension to index.php?
Normally, the people in the forum help with coding, we do not code on request. I would suggest starting with the Apache documentation:
[httpd.apache.org...]
Then review the posts here to get an idea of what you will need to do. Each scenario you asked about is possible, but will have to be addressed separately, yet structured to function as a whole.
When you have what you think you need, then post the code you think will work, or have tried and know doesn't, and someone here will help you find the answers you need.
Justin