CodeIgniter Forums
.htaccess issues help needed!!!! - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: .htaccess issues help needed!!!! (/showthread.php?tid=17834)

Pages: 1 2 3


.htaccess issues help needed!!!! - El Forum - 04-20-2009

[eluser]learning_php[/eluser]
Hi,

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;html&gt;
&lt;head&gt;
&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;
&lt;/head&gt;
&lt;body&gt;
<center>
<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>
&lt;/object&gt;
</div>
</div>
</div>
<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">
<ul>
<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>
</ul>
</div>
</div>
<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>

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


.htaccess issues help needed!!!! - El Forum - 04-20-2009

[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.
http://www.danielwmoore.com/remove_index_from_codeigniter

Let me know how that works out for you.


.htaccess issues help needed!!!! - El Forum - 04-20-2009

[eluser]Dam1an[/eluser]
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)


.htaccess issues help needed!!!! - El Forum - 04-20-2009

[eluser]learning_php[/eluser]
Hi,

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

Thanks for all your help!!!!!!


.htaccess issues help needed!!!! - El Forum - 04-20-2009

[eluser]Dam1an[/eluser]
You can use the routes file to remove the controller name from the URL
See here for more info


.htaccess issues help needed!!!! - El Forum - 04-20-2009

[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?


.htaccess issues help needed!!!! - El Forum - 04-20-2009

[eluser]learning_php[/eluser]
Hi,

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>

<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
</IfModule>

restated apache and mysql and seemed to work.

thanks


.htaccess issues help needed!!!! - El Forum - 04-20-2009

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

If you later find you attempt to call an URL such as:
Code:
http://localhost/wedding-site/groom-stuff/tuxes/

but it will only go to:
Code:
http://localhost/wedding-site/

then you may want to add the QSA flag to your list of flags, like so:
Code:
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.