I have add some rules in .htaccess file for urls work base on case sensitive, but some urls of my website which is created by using database not work base on case sensitive. Please guide how to resolve this issue?
Related
I have a cakephp 3 script installed on my cpanel account.
this domain is the primary domain for account but i have relocated it to a subfolder for necessary reasons.
my htaccess rewrites it perfectly and every url works both with and without /subfolder/ in the url.
However, all the links in cakephp automatically append /subfolder/ back into the url.
I even tried manually replacing $base_url in configuration.php with 'mydomain.com'; only, but that didn't work. Then I replaced every instance in all the hundreds of files of $base_url with 'mydomain.com'; but still, nothing changed and it still shows that /subfolder/ in every url even when i access mydomain.com directly._
I need to get rid of this /subfolder/ in the url that cakephp is serving from php. i tried everything i knew but nothing works.
Please tell me how to solve this problem.
Have you tried setting App.base, App.webroot? Setting those values up will disable automatic directory detection and should help you get the URLs you want. See configuration docs for more on those values.
my framework is codeigniter and my site works fine.
example :
www.example.com/
now,I have copied all my codeigniter's folders to another dir like this:
www.example.com/test
now my urls:
www.example.com/profile //works fine
www.example.com/test/profile //not work
I get 404 page not found .
I changed base_url to :
$config['base_url'] = 'http://www.example.com/test';
where is my wrong?
please have a look at your .htaccess file. Because it'll be in the RewriteBase condition in there. Check it and tell what You found.
Codeigniter does not support multiple subdirectory levels in your controllers
But still you can extend it.
You might have to extend Router Class
Do you still have all CodeIgniter files in your main directory?
If yes, then you must remove them or you can create SUBDOMAIN to solve the issue.
Note: Codeigniter don't support multiple subdirectory levels in your controllers.
If no, then you must look for your .htaccess file, it'll be the RewriteBase condition in there.
http://localhost/projectname/
The above url works fine .
But if we input
http://localhost/PROJECTNAME/
it gives a "404 Page Not Found" error.
I just want to know how to convert Uppercase PROJECTNAME to Lowercase projectname.
I am using php 5.4 along with IIS 8.5.
And I also want to get rid of index.php.
I need some help with the rewrite rule or routing or maping.
Any help will be appreciated. Thanks.
You have to do it by htacces only,
Best way is don't use localhost use virtual host
Use the ip directly ,you can get a bind pannel there you can set ip
I am building a router in PHP. I was wondering how I can map /profile?id=3 to /user/3. Is there any way to do this in PHP without .htaccess?
What you could do is create a base entry point which catch all urls like in Symfony, for example.
This entry point could be a app.php file at the root of your project. You can access it via urls like http://yourdomain.com/app.php/user/3.
This entry point will use the URL part after app.php to invoque corresponding controller, extract the user ID and render HTML.
Then, in your apache config, you create a rewrite rule that will prepend all URLs with app.php. http://yourdomain.com/user/3 will be mapped under the hood by apache to http://yourdomain.com/app.php/user/3.
An exemple of such a rewrite rule can be found here.
After that, if you want to support other routes, like /myblog/great-entry or anything else, you can handle them from PHP side. You won't have to edit your apache config ever again, because every URL are catched by your app.php file.
The URL needs to be rewritten from that shortened form, to a query string to be passed to PHP. You cannot accept /user/3 in PHP in any way as it's not going to be populated in the $_GET superglobal array.
You don't need to put rewrite rules in .htaccess files, as they're per-directory inherited. But you still need mod_rewrite.
As you're using PHP, I'm assuming you're not running it on the CLI, so you must be using Apache or Nginx. That being the case, what's the problem running mod_rewrite and putting the rules in the config?
I am building a site that will (obvisouly) have a front end public portion that I want to drive with Concrete5, but then it will also have a members section that I would like to build with Code Igniter.
Does anyone have any idea how I could do that?
I guess I could just throw the Code Igniter code into a sub directory, but would I run into any issues with that?
i can't see why not.
As you suggested a separate folder on the site would be one solution.
(you might have to tweak the .htaccess file (if you are using one) to ignore the other cms/framework
Another solution would be to have separate subdomains,
eg example.com and members.example.com
The answer, since the OP hasn't posted it, is to change the .htaccess rule:
RewriteBase /
to:
RewriteBase /foo/
where foo is your subdirectory that the index.php and CI reside. This .htaccess should also be in the same folder as the CI index.php. Works like a charm. Also don't forget to add the subdirectory to the base_url config setting.
I ended up using a sub directory for Code Igniter. I had to change the .htaccess file and Mod_Rewrite rules for apache in order for the Code Igniter "pretty" URLs to work correctly.
I will post the code later if I remember.