.htaccess or something adds additional stuff to the URL. PHP -
i started work .htaccess on website i'm working on. works fine, when try acces user.php file located on index, keep getting url:
on every other file , place, works great.
this function call different pages depending on url :
public function lifeline() { global $templatepath; if ( isset($_get['url']) && $_get['url'] !== 'user' ) { $url = $_get['url']; $result = mysql_query("select * posts url='$url' "); if ( !mysql_num_rows($result) ) { if ( file_exists($templatepath.'404.php') ) { include_once($templatepath.'404.php'); } else { include_once('404.php'); } } while($row = mysql_fetch_assoc($result)){ if ( $row['type'] === 'post' ) { include_once($templatepath.'post.php'); } elseif ( $row['type'] === 'page' ) { include_once($templatepath.'page.php'); } } } elseif ($_get['url'] === 'user') { include_once($templatepath.'user.php'); } else { include_once($templatepath.'index.php'); } }
and .htaccess file.
options +followsymlinks -multiviews rewriteengine on rewriterule ^([a-za-z0-9_-]+)$ index.php?url=$1 rewriterule ^([a-za-z0-9_-]+)/$ index.php?url=$1 rewriterule ^(.+)(\s|%20)(.+)$ /$1-$3 [r=301,qsa,l,ne] errordocument 404 /404.php
and if url this:
without /?url=user
sorry if sound noobish. :(
without examining closely, last rewriterule
in .htaccess includes [r=301]
, making rule capable of "adding" (i.e. redirecting to) /?user=x
. i'd take closer @ last rule.
Comments
Post a Comment