Welcome Guest, Not a member yet? Register   Sign In
.htaccess issues help needed!!!!


here is how i am linking to the page:

<?= anchor('homepage/gallery','Gallery');?>

and here is the content:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
&lt;title&gt;Hannah & Stephen's Wedding&lt;/title&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
&lt;link rel='stylesheet' href='&lt;?=base_url()?&gt;assets/css/styles.css' type='text/css' /&gt;
<div id="wrapper">
<div id="top"><img src='&lt;?=base_url()?&gt;assets/images/weddingsite_01.jpg' alt='' /></div>
<div id="banner">
<div id="bannerleft"><img src='&lt;?=base_url()?&gt;assets/images/weddingsite_02.jpg' alt='' /></div>
<div id="photo"><img src='&lt;?=base_url()?&gt;assets/images/weddingsite_03.jpg' alt='' /></div>
<div id="gapfiller"></div>
<div id="countdown">
<div id="countdownimg">
&lt;object id="flash" &gt;
&lt;embed src='&lt;?=base_url()?&gt;assets/flash/countdown.swf'&gt;&lt;/embed>
<div id="menu">
<div id="topimg"><img src='&lt;?=base_url()?&gt;assets/images/topnav.jpg' alt='' /></div>
<div id="leftimg"><img src='&lt;?=base_url()?&gt;assets/images/menuleft.jpg' alt='' /></div>
<div id="date"><img src='&lt;?=base_url()?&gt;assets/images/date.jpg' alt='' /></div>
<div id="menuItems">
<li>&lt;?= anchor('homepage','Homepage');?&gt;</li>
<li>&lt;?= anchor('homepage/info','Information');?&gt;</li>
<li>&lt;?= anchor('homepage/Gifts','Gifts');?&gt;</li>
<li>&lt;?= anchor('homepage/gallery','Gallery');?&gt;</li>
<div id="bnav"><img src='&lt;?=base_url()?&gt;assets/images/undernav.jpg' alt='' /></div>

<div id="header"><img src='&lt;?=base_url()?&gt;assets/images/gallerypage.jpg' alt='' /></div>
<div id="main">
<div id="mainleft"><img src='&lt;?=base_url()?&gt;assets/images/mclp.jpg' alt='' /></div>

<div id="linksc">
<h1><a href="http://www.ashworthphotography.co.uk/" target="_blank">www.ashworthphotography.co.uk</a></h1>
<h1><a href="http://www.nathanbamford.co.uk/" target="_blank">www.nathanbamford.co.uk</a></h1>
<h1><a href="http://www.theweddingshop.co.uk/" target="_blank">www.theweddingshop.co.uk</a></h1>
<h1><a href="http://www.jockey-club-estates.co.uk/Pages/Page.aspx?PageName=JCE-Home" target="_blank">www.jockey-club-estates.co.uk</a></h1>
<h1><a href="http://www.moultonsuffolk.co.uk/" target="_blank">www.moultonsuffolk.co.uk</a></h1>

<div id="maincontentbody"><h1>Coming Soon</h1></div>
<div id="footer"><img src='&lt;?=base_url()?&gt;assets/images/bottom.jpg' alt='' /></div>

[eluser]Daniel Moore[/eluser]
The error log showing the referrer is "http://localhost/wedding-site/" shows much.

If you're using CI, then this problem is most likely in your .htaccess.

Visit the following page and try the solution(s) mentioned there.

Let me know how that works out for you.

Do you get any errors using just &lt;? = base_url() ?&gt; cause thats the only thing I can see potentially causing a problem (well, the only bit of PHP in the view really)


It is working now but is it possible to remove the controller name formt the url aswell?

Thanks for all your help!!!!!!

You can use the routes file to remove the controller name from the URL
See here for more info

[eluser]Daniel Moore[/eluser]
[quote author="learning_php" date="1240250773"]Hi,

It is working now but is it possible to remove the controller name formt the url aswell?

Thanks for all your help!!!!!![/quote]

As I am working on writing a tutorial to help people with just these types of issues, would you please let us know exactly what method you used to fix the issue, since you have multiple people giving advice?


I first did this:

I used to have the same problem when I first started using XAMPP on windows (using the extract only version)

First, backup your htdocs and mysql/data folder

The way I solved it, was by uninstalling it, and then using the installer version
After you install it (don’t start the server up yet), don’t visit localhost, but replace the htdocs and mysql/data folder with the ones you backed up earlier.

You can now start apache and MySQL, and visit localhost

then resaved my .htaccess file to this:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /wedding-site/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /wedding-site/index.php/$1 [NC,L]

<IfModule !mod_rewrite.c>
# If we don’t have mod_rewrite installed, all 404’s
# can be sent to index.php, and everything works as normal.

ErrorDocument 404 /index.php

restated apache and mysql and seemed to work.


[eluser]Daniel Moore[/eluser]
I notice your rewrite line is as follows:
RewriteRule ^(.*)$ /wedding-site/index.php/$1 [NC,L]

If you later find you attempt to call an URL such as:

but it will only go to:

then you may want to add the QSA flag to your list of flags, like so:
RewriteRule ^(.*)$ /wedding-site/index.php/$1 [QSA,NC,L]

What the QSA flag does is a Query String Append. It is required on my particular XAMPP setup, and doesn't properly redirect without it. I'm not sure why, as I don't send query strings, but it doesn't hurt to have it. It will do no harm to have it in place on any of your .htaccess file RewriteRules, unless you're doing one for something other than CodeIgniter in which you wish to definitely discard the query string.

Theme © iAndrew 2016 - Forum software by © MyBB