• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rewrite public from url

#1
i have installed ci4 in my local environment and now i wants to rewrite url as 
http://localhost/ci4/pages/add
 but the problem is i have to include 
http://localhost/ci4/public/index.php/pages/add

how can i achieve this
please provide .htaccess files for this issue

I have installed on /ci4 folder

and i dont wana set virtual host,i need simplicity
Reply

#2
Have you tried https://codeigniter4.github.io/CodeIgnit...x-php-file
Reply

#3
Thanks for Quick Reply
My scenario is
I am using Ampps for local server
i am accessing ci3 sites with localhost/ci3demo which is working fine
I have installed ci4 using composer and for now i don't wana move system files outside to root folder.
i just wants is i need to access localhost/ci4/pages/somemethods which is not working but localhost/ci4/public/index.php/pages/somemethods is working.. all i wants is remove index.php and public from url.
I have already followed installation guide and the links you pointed.still no luck
Reply

#4
Hmm ... CI4 is not intended for use as a subfolder (localhost/ci4/...). Our intent is that you map the document root of your test server, or for a virtual host, to the public folder inside your project.
Alternately, "php spark serve" inside your project root, and check localhost:8080
Reply

#5
As Ciadmin said, this is two part problem - removing 'ci4/public' from URL and removing 'index.php' from URL.

Using localhost had some limitations anyway that I can't remember right now, but you can set up mock domain in your hosts file (C:\Windows\System32\drivers\etc\hosts), add 127.0.0.1 mydomain.local in there.

Then update Apache virtual hosts so that mydomain.local points to htdocs/ci4/public/ holder.

And then, entering http://mydomain.local in your browser should now open your correct website.

You can of course replace mydomain.local with anything you want to.

Little heads up, we used mydomain.dev and at some point Google made Chrome treat .dev as special domain that couldn't be local connection, because of some internal reasons how Google had set up their tools, so we had to come up with another mock top level domain name.
Reply

#6
(12-20-2018, 01:53 AM)Pertti Wrote: Little heads up, we used mydomain.dev and at some point Google made Chrome treat .dev as special domain that couldn't be local connection, because of some internal reasons how Google had set up their tools, so we had to come up with another mock top level domain name.

Small point-of-interest on the use of the .dev TLD. You can use it for local development, but it must be a secure connection. In other words, it must use https:

Like you, I've switched to .local or .test
Reply

#7
(12-20-2018, 10:15 AM)dave friend Wrote: Small point-of-interest on the use of the .dev TLD. You can use it for local development, but it must be a secure connection. In other words, it must use https:

Possible, to be honest we had to rush any kind of solution out ASAP to keep working as team, and didn't really spend too much on figuring out what they've done.

I suppose there's some logic in it, but at the same time it's a bit pain and very hard to pinpoint the issue if you first arrive at it.

Or I guess I should learn how to do signed sites on my local machine one day Big Grin
Reply

#8
I found out the hard way when a dev site that had been working perfectly suddenly began failing at unpredictable times.

Nothing had changed in code or server config. This site already had a self-signed certificate in place and eventually we realized it was the non-SSL calls that were failing. It still took a long time to learn the problem behavior had been baked into the Chrome browser.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.