Url masking help
August 2nd, 2013
http://lifehomeopathy.ca/wp
in adress bar i would like it to just show
http://lifehomeopathy.ca
i read it can be done via mod re write using .htaccess file but im not sure how to do it at least i wasnt successful so far
also currently using an index.php to redirect the url
<?php
header("location:http://www.lifehomeopathy.ca/wp");
exit;
?>
this will help you
http://corz.org/serv/tricks/htaccess2.php
TheGreatKali replied: this will help you
http://corz.org/serv/tricks/htaccess2.php
i tried that dont know what i m doing wrong
Opera has this feature embedded… not sure if you can see the code with dragonfly though.
Move everything from the wp folder into root and problem solved.
try this in htaccess:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(.*)/$ /$1/wp [L]
Or this:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /wp/$1 [L]
You can also redirect index.php in htaccess with this:
RewriteCond %{THE_REQUEST} /index.php HTTP
RewriteRule (.*)index.php$ /$1 [R=301,L]
moobot replied: try this in htaccess:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(.*)/$ /$1/wp [L]
Or this:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /wp/$1 [L]
You can also redirect index.php in htaccess with this:
RewriteCond %{THE_REQUEST} /index.php HTTP
RewriteRule (.*)index.php$ /$1 [R=301,L]
i get a error when i upload the .htacess file
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@lifehomeopathy.ca and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
this is what i did i created a .htacess file and added the above code and put it in the www directory theres only 2 file there index /htacess
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(.*)/$ /$1/wp [L]
hopefully someone could help for now this does the job
<?php
$URL = "http://lifehomeopathy.ca/wp/"; // the url of
the page that you want to load.
$base = '<base href="'.$URL.'">';
$host = preg_replace('/^[^\/]+\/\//','',$URL);
$tarray = explode('/',$host);
$host = array_shift($tarray);
$URI = '/' . implode('/',$tarray);
$content = '';
$fp = @fsockopen($host,80,$errno,$errstr,30);
if(!$fp)
{
echo "Unable to open socked: $errstr
($errno)\n"; exit;
}
fwrite($fp,"GET $URI HTTP/1.0\r\n");
fwrite($fp,"Host: $host\r\n");
if( isset($_SERVER["HTTP_USER_AGENT"]) )
{
fwrite($fp,'User-Agent: '.$_SERVER
["HTTP_USER_AGENT"]."\r\n");
}
fwrite($fp,"Connection: Close\r\n");
fwrite($fp,"\r\n");
while (!feof($fp))
{
$content .= fgets($fp, 128);
}
fclose($fp);
if( strpos($content,"\r\n") > 0 )
{
$eolchar = "\r\n";
}
else
{
$eolchar = "\n";
}
$eolpos = strpos($content,"$eolchar$eolchar");
$content = substr($content,($eolpos + strlen
("$eolchar$eolchar")));
if( preg_match('/<head\s*>/i',$content) )
{
echo( preg_replace('/<head\s*>/i','<head>'.
$base,$content,1) );
}
else
{
echo( preg_replace('/<([a-z])([^>]+)>/i',"<\
\1\\2>".$base,$content,1) );
}
?>