MyBB Community Forums

Full Version: htaccess mod rewrite not working?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Yo,

So I am working on my portfolio and can't seem to get modrewrite working at all.

In .htaccess
RewriteEngine on
RewriteRule ^([^/\.]+)/?$ /index.php?url=$1 [L]

An example of a page
<?php
if(empty($_GET['url'])){
	$where = "index";
}else{
	$where = $_GET['url'];
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo ucwords($where); ?></title>
<link href="css.css" rel="stylesheet" type="text/css" />
</head>

<body>
	<div class="container">
    	<div class="logo"></div>
    
        <div style="text-align:center; width:1500px; margin-left:auto; margin-right:auto;">
            <img id="Image-Maps_4201201251235035" src="content/images/menubar.png" usemap="#Image-Maps_4201201251235035" border="0" width="1500" height="62" alt="" />
            <map id="_Image-Maps_4201201251235035" name="Image-Maps_4201201251235035">
            <area shape="rect" coords="455,7,583,57" href="index.php?url=index" alt="" title="" onMouseOver="if(document.images) document.getElementById('Image-Maps_4201201251235035').src= 'content/images/home.png';" onMouseOut="if(document.images) document.getElementById('Image-Maps_4201201251235035').src= 'content/images/menubar.png';"  />
            <area shape="rect" coords="582,7,744,57" href="index.php?url=portfolio" alt="" title="" onMouseOver="if(document.images) document.getElementById('Image-Maps_4201201251235035').src= 'content/images/portfolio.png';" onMouseOut="if(document.images) document.getElementById('Image-Maps_4201201251235035').src= 'content/images/menubar.png';"  />
            <area shape="rect" coords="744,7,905,57" href="index.php?url=about" alt="" title="" onMouseOver="if(document.images) document.getElementById('Image-Maps_4201201251235035').src= 'content/images/about.png';" onMouseOut="if(document.images) document.getElementById('Image-Maps_4201201251235035').src= 'content/images/menubar.png';"  />
            <area shape="rect" coords="905,7,1066,57" href="index.php?url=contact" alt="" title="" onMouseOver="if(document.images) document.getElementById('Image-Maps_4201201251235035').src= 'content/images/contact.png';" onMouseOut="if(document.images) document.getElementById('Image-Maps_4201201251235035').src= 'content/images/menubar.png';"  />
            </map>
        </div>
        <div class="content">
        	<div class="leftCon">
            	<?php include_once("content/".$where.".html"); ?>	
            </div>
            
            <div class="rightCon">
            	<div class="headerUpdate"></div>
				<p>Added a new blog post titled "Welcome"</p>
                <p>Added a new item into my portfolio</p>
            </div>
        
        </div>
    
    </div>

Any ideas?
What exactly do you want?

Try:

RewriteEngine on
RewriteRule ^(.*)$ index.php?url=$1 [L]
Not sure though, I don't do much M-RW.
Oh yeh sorry for example when I link to something at the mo it's URL/index.php?url=PLACE and I want it to be URL/PLACE so it looks like folder links, can't remember what it is called.

how would I link things with it as well? Would i still use index.php?url=PLACE or would i just use PLACE/

Your solution didn't work at all :s