<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>CodeIgniter routing problem &#8211; Learn PHP online</title>
	<atom:link href="https://www.learnphponline.in/tag/codeigniter-routing-problem/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.learnphponline.in</link>
	<description>The Best Free Tutorials of Programming Languages in 2019</description>
	<lastBuildDate>Fri, 09 Jul 2021 09:24:52 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.3</generator>
	<item>
		<title>CodeIgniter routing problem &#8211; Showing Homepage but not others</title>
		<link>https://www.learnphponline.in/codeigniter-routing-problem-showing-only-homepage-but-not-others/</link>
					<comments>https://www.learnphponline.in/codeigniter-routing-problem-showing-only-homepage-but-not-others/#respond</comments>
		
		<dc:creator><![CDATA[Learn PHP online]]></dc:creator>
		<pubDate>Fri, 09 Jul 2021 08:40:44 +0000</pubDate>
				<category><![CDATA[Codeigniter]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[ci]]></category>
		<category><![CDATA[CodeIgniter routing problem]]></category>
		<category><![CDATA[routes]]></category>
		<guid isPermaLink="false">https://www.learnphponline.in/?p=12047</guid>

					<description><![CDATA[<p>CodeIgniter routing problem: This is not a very common problem. It comes in few cases but the problem is a problem and finding a solution is very necessary. I have a very useful solution for you and it will definitely help you to solve the Codeigniter 3 &#38; 4 routes problem. This...</p>
<p>The post <a rel="nofollow" href="https://www.learnphponline.in/codeigniter-routing-problem-showing-only-homepage-but-not-others/">CodeIgniter routing problem &#8211; Showing Homepage but not others</a> appeared first on <a rel="nofollow" href="https://www.learnphponline.in">Learn PHP online</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>CodeIgniter routing problem: </strong>This is not a very common problem. It comes in few cases but the problem is a problem and finding a solution is very necessary. I have a very useful solution for you and it will definitely help you to solve the <a href="https://www.learnphponline.in/change-codeigniter-environment-variable/">Codeigniter</a> 3 &amp; 4 routes problem.</p>
<p>This problem comes when you are using the Nigix Linux server or Apache Linux server. and also your project is in a subdirectory Like: <em>/var/www/example.com/app</em>  or  /<em>var/www/html/app</em>.</p>
<p>&nbsp;</p>
<p>As you Codeigniter routes working <em>.htaccess</em> file and the problem is also here. but changing anything related to<em> the .htaccess</em> file you need to answer few things.</p>
<h3><strong>My CodeIgniter config.php file should like given below:</strong></h3>
<div>
<pre>$base_url   = (isset($_SERVER['HTTPS']) ? "https://" : "http://").$_SERVER['HTTP_HOST'];
$base_url  .= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
$config['base_url'] = $base_url;
<em>$config['index</em>page’] = “;
$config['uri_protocol’] = '<em>REQUEST_URI</em>’;</pre>
</div>
<p>&nbsp;</p>
<h3><strong>My CodeIgniter .htaccess file should be like given below:</strong></h3>
<pre>RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST<em>FILENAME} !-f
RewriteCond %{REQUEST</em>FILENAME} !-d
RewriteCond $1 !^(index.php|assets|upload|robots.txt|.<em>.css)
RewriteRule ^(.</em>)$ index.php?/$1 [L]</pre>
<p>&nbsp;</p>
<p>So, if this is all good with your project that means your code and <a href="https://stackoverflow.com/questions/13170819/what-is-htaccess-file"><em>.htaccess</em></a> file is good and you need to access the server terminal or server, support team.</p>
<p>Also, read about <a href="https://www.learnphponline.in/top-blogger-in-india-in-2021/">the top richest Indian blogger</a> and how to earn money via blogging.</p>
<p>&nbsp;</p>
<h3>For Apache Linux server:</h3>
<p><img fetchpriority="high" decoding="async" class="aligncenter wp-image-12049 size-full" src="https://www.learnphponline.in/wp-content/uploads/2021/07/linux-server.jpeg" alt="CodeIgniter routing problem" width="470" height="205" srcset="https://www.learnphponline.in/wp-content/uploads/2021/07/linux-server.jpeg 470w, https://www.learnphponline.in/wp-content/uploads/2021/07/linux-server-300x131.jpeg 300w" sizes="(max-width: 470px) 100vw, 470px" /></p>
<p>I believe that you need to enable <code>AllowOverride</code> in order for your <code>.htaccess</code> to take effect.</p>
<p>To do that you need to add the following in your Vhost:</p>
<pre>&lt;Directory /var/www/learnphponline.in/app&gt;
   Options Indexes FollowSymLinks
   AllowOverride All
   Require all granted
&lt;/Directory&gt;</pre>
<p>&nbsp;</p>
<p><strong>Note:-</strong> that you need to update the <code><span class="highlight">/var/www/learnphponline.in/public</span></code> part to match your document root. Then run a config test and restart Apache. After that, the rules that you have in your <code>.htaccess</code> file would take effect.</p>
<p>&nbsp;</p>
<h3>For Nginx, PHP-FPM:</h3>
<p><img decoding="async" class="aligncenter wp-image-12048" src="https://www.learnphponline.in/wp-content/uploads/2021/07/nginx.png" alt="CodeIgniter routing problem" width="647" height="324" srcset="https://www.learnphponline.in/wp-content/uploads/2021/07/nginx.png 1720w, https://www.learnphponline.in/wp-content/uploads/2021/07/nginx-300x150.png 300w, https://www.learnphponline.in/wp-content/uploads/2021/07/nginx-1024x513.png 1024w, https://www.learnphponline.in/wp-content/uploads/2021/07/nginx-768x385.png 768w, https://www.learnphponline.in/wp-content/uploads/2021/07/nginx-1536x770.png 1536w" sizes="(max-width: 647px) 100vw, 647px" /></p>
<p>find the file <em>nginx.conf</em> and add this code:</p>
<pre><code>location / {
    # nginx won't display 404, we leave this to Rails
    try_files $uri @passenger;
}

location @passenger {
   passenger_app_root /var/www/learnphponline.in/;
   passenger_document_root /var/www/learnphponline.in/app/;
   passenger_enabled on;
}</code></pre>
<p>&nbsp;</p>
<h2>Summary for the CodeIgniter routing problem</h2>
<p>Hope this will help you or at least you get an idea of what issue you are facing. Migration from one server to another or from localhost to live server will create this kind of issue. But if you have proper support from the server team or admin then it will be very easy for you to solve this.</p>
<p>&nbsp;</p>
<p>Also, read about the <a href="https://www.learnphponline.in/programing-language-for-freelancing/">Top 10 best freelancing</a> languages or <a href="https://www.learnphponline.in/top-10-programming-languages/">Top 10 programming languages.</a></p>
<div class="pvc_clear"></div>
<p id="pvc_stats_12047" class="pvc_stats all  " data-element-id="12047" style=""><i class="pvc-stats-icon medium" aria-hidden="true"><svg aria-hidden="true" focusable="false" data-prefix="far" data-icon="chart-bar" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="svg-inline--fa fa-chart-bar fa-w-16 fa-2x"><path fill="currentColor" d="M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z" class=""></path></svg></i> <img decoding="async" width="16" height="16" alt="Loading" src="https://www.learnphponline.in/wp-content/plugins/page-views-count/ajax-loader-2x.gif" border=0 /></p>
<div class="pvc_clear"></div>
<p>The post <a rel="nofollow" href="https://www.learnphponline.in/codeigniter-routing-problem-showing-only-homepage-but-not-others/">CodeIgniter routing problem &#8211; Showing Homepage but not others</a> appeared first on <a rel="nofollow" href="https://www.learnphponline.in">Learn PHP online</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.learnphponline.in/codeigniter-routing-problem-showing-only-homepage-but-not-others/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
