unlishema.wolf Posted January 1, 2013 Share Posted January 1, 2013 I am working on writing a htaccess file to "hide" my $_GET fields. However I am only able to do 1 field and sometimes I have multiple (Examples below). I do not know the santex of htaccess hardly at all. Current urls I can have: http://unlishema.us.to http://unlishema.us.to/?p=projects http://unlishema.us.to/?p=projects&p2=minecraft http://unlishema.us.to/?p=forum http://unlishema.us.to/?p=forum&c=1 http://unlishema.us.to/?p=forum&c=1&t=2 My current rewrite rule is as follows: <IfModule mod_rewrite.c> Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^/]*)$ http://unlishema.us.to/?p=$1 [L] </IfModule> I need someone with knowledge of htaccess to help me make a rewrite rule that can work with all these urls. Quote Link to comment https://forums.phpfreaks.com/topic/272571-htaccess-and-_get/ Share on other sites More sharing options...
requinix Posted January 1, 2013 Share Posted January 1, 2013 To "hide" them you have to have the information somewhere in the URL. Where does the p2= value go? Maybe a second directory like /projects/minecraft? How about the c= and t=? Quote Link to comment https://forums.phpfreaks.com/topic/272571-htaccess-and-_get/#findComment-1402541 Share on other sites More sharing options...
unlishema.wolf Posted January 1, 2013 Author Share Posted January 1, 2013 (edited) What I would like to do is the following. Sorry for not including in the first post: http://unlishema.us.to http://unlishema.us.to/projects http://unlishema.us.to/projects/minecraft http://unlishema.us.to/forum http://unlishema.us.to/forum/1 http://unlishema.us.to/forum/1/2 I don't have to worry about the forum's as far as indicating 1 is c and not p2. The only code I have that gets p2 is in my main index. The fourm index has completely separate code. I just need to modify my url so it gives me the info but it looks like a directory not $GET values. Edited January 1, 2013 by unlishema.wolf Quote Link to comment https://forums.phpfreaks.com/topic/272571-htaccess-and-_get/#findComment-1402550 Share on other sites More sharing options...
unlishema.wolf Posted January 1, 2013 Author Share Posted January 1, 2013 (edited) Also I have been working on trying to get this to work off and on. I have got http://unlishema.us.to/news to redirct to http://unsliehma.us.to/?p=news and it works. However, when i try to redirect http://unlishema.us.to/projects/minecraft it redirects fine but it then tries to load my style from http://unlishema.us.to/projects/styles/default/style.css along with my images and everything. Here is my code so you can see the exact problem. You can also see my live site at http://unlishema.us.to but just FYI the nav links are for the old index.php not the new one. .htaccess <Files .htaccess> order allow,deny deny from all </Files> Options -Indexes RewriteEngine on Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([a-z0-9\-]+)/([a-z0-9\-]+)/([a-z0-9\-]+)$ index.php?p=$1&c=$2&t=$3 [L] RewriteRule ^([a-z0-9\-]+)/([a-z0-9\-]+)$ index.php?p=$1&c=$2 [L] RewriteRule ^([a-z0-9\-]+)$ index.php?p=$1 [L] RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://(www\.)?unlishema.us.to/.*$ [NC] RewriteRule .*\.(jpe?g|gif|bmp|png)$ http://i.imgur.com/qX4w7.gif [NC,R,L] ErrorDocument 400 http://unlishema.us.to/?error ErrorDocument 401 http://unlishema.us.to/?error ErrorDocument 403 http://unlishema.us.to/?error ErrorDocument 404 http://unlishema.us.to/?error ErrorDocument 500 http://unlishema.us.to/?error index.php <?php $Page_Name="Projects"; $style="default"; $href="./"; $u_agent = $_SERVER['HTTP_USER_AGENT']; $page="main"; if(isset($_GET['p'])) $page=$_GET['p']; if($page == "projects") { if(isset($_GET['c'])) $project = $_GET['c']; if(!isset($project)) include $href."project/default.php"; else include $href."project/other.php"; } else if($page == "gallery") { include $href."gallery.php"; } else if($page == "forum")) { include $href."forum.php"; } else { $type=$page; include $href."default.php"; } include $href."styles/$style/footer.php"; ?> Edited January 1, 2013 by unlishema.wolf Quote Link to comment https://forums.phpfreaks.com/topic/272571-htaccess-and-_get/#findComment-1402565 Share on other sites More sharing options...
unlishema.wolf Posted January 1, 2013 Author Share Posted January 1, 2013 I went through all my files and changed my dynamic links to hard links and fixed it. Next on my list is to redo my dynamic links after i find error. Quote Link to comment https://forums.phpfreaks.com/topic/272571-htaccess-and-_get/#findComment-1402574 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.