Web Hosting Talk







View Full Version : htaccess blocks certain links how to add?


mystycs
04-12-2010, 11:33 PM
I have an htaccess file that makes it so anything i go to for example /page.html makes it redirect back to my domain. The htaccess file i have is made to only go to certain links and it is made for user profiles such as /username it makes that work. I need to add for it to pull xd_receiver.htm for facebook but if i go to it for example domain.com/xd_receiver.html how can i make it so it goes there and doesnt redirect back to the main page.

Here is my htaccess file

DirectoryIndex index.html index.htm default.htm index.php
Options +FollowSymlinks
RewriteEngine on

RewriteRule ^(.*\.(css|swf|js|xml|gif|jpg))$ $1 [L,QSA,NE]
RewriteRule ^((images|xd_receiver.htm|css|blog|script|style|docs|admin|fck|swf|Scripts|includes|images|img|uploads|templates|js|css|calendar|expert_area|fckfiles| flvplayer|highslide)/.*) $1 [L,QSA,NE]
RewriteRule ((fb_login|phpinfo|aim|csql|info|cron|index|site|simg|img|ajax|ari|fck_install|ffmpeg_test|file|redirect|rss_blogs|rss_info)\.php) $1 [L,QSA,NE]
RewriteRule ^ajax/?$ ajax.php [L,QSA,NE]


RewriteRule ^(.*)$ index.php?htaccesss=%{HTTP_HOST}%{REQUEST_URI} [L,QSA,NE]

I also have a htaccess php file that includes this

<?
$htaccess_rules = array(
'^servicepage/([^/]+)/?$' => 'mod=servicepage&act=$1',
'^servicepage/([^/]+)/([^/]+)/?$' => 'mod=servicepage&act=$1&data=$2',
'^signup/?$' => 'mod=signup',
'^fb_signup/?$' => 'mod=fb_signup',
'^login/?$' => 'mod=login',
'^recover/?$' => 'mod=recover',
'^recover/([^/]+)/?$' => 'mod=recover&act=$1',
'^settings/?$' => 'mod=settings',
'^settings/([^/]+)/?$' => 'mod=settings&act=$1',
'^settings/([^/]+)/([^/]+)/?$' => 'mod=settings&act=$1&do=$2',
'^inbox/?$' => 'mod=inbox',
'^inbox/([^/]+)/?$' => 'mod=inbox&act=$1',
'^inbox/([^/]+)/([0-9]+)/?$' => 'mod=inbox&act=$1&id=$2',
'^search/?$' => 'mod=search',
'^following/?$' => 'mod=following',
'^following/([^/]+)/?$' => 'mod=following&act=$1',
'^contact/?$' => 'mod=contact',
'^terms/?$' => 'mod=terms',
'^privacy/?$' => 'mod=privacy',
'^help/?$' => 'mod=help',
'^logout/?$' => 'logout=1',
'^([^/]+)/?$' => 'mod=users&user=$1',
'^([^/]+)/([0-9]+)/?$' => 'mod=users&user=$1&page=$2',
'^([^/]+)/([^/]+)/?$' => 'mod=users&user=$1&act=$2',
'^([^/]+)/([^/]+)/([0-9]+)/?$' => 'mod=users&user=$1&act=$2&id=$3',
);

list($htaccess_subdomain, $htaccess_path) = explode($_SITEURL.'/', $_GET['htaccesss']);

$flag = 0;
if(!$htaccess_path) $flag=1;

foreach($htaccess_rules as $ereg=>$repl){
$s = preg_replace('!'.$ereg.'!', $repl, $htaccess_path);
if($s != $htaccess_path) {
parse_str($s, $newget);
foreach($newget as $k=>$v) $_GET[$k]=$_REQUEST[$k]=$v;
$flag=1;
break;
}
}

if(!$flag) { header("HTTP/1.1 301 Moved Permanently"); header("location: http://".$_SITEURL); die; }

?>



How can i allow for example xd_receiver.htm link to work and not redirect back to main page.

mystycs
04-13-2010, 12:11 AM
nvm got it fixed!