routes question |
This is only partially a Codeigniter question perhaps, but since I am working with CI, I will give it a shot.
My app's public files are placed on a subdirectory of a domain, say: https://mydomain.com/movies/ The server is an apache server. And I need to make one controller accessible to the outside world in a way that the subdirectory through which the app is accessible would not be visible; let's say the controller is Dogfood.php and I need it's methods to be accessible via such link: https://mydomain.com/dogfood/ So, if a user tries to access https://mydomain.com/dogfood/, he would be, under the hood, accessing https://mydomain.com/movies/dogfood/. But this should be hidden from the user. I can write a rule in the public_html/ folder's .htaccess file that would work for regular files if the "dogfood" was a directory (without it's own .htaccess file), so trying to access https://mydomain.com/dogfood/image.png would load https://mydomain.com/movies/dogfood/image.png : Code: RewriteRule "^dogfood/(.*)$" "/movies/dogfood/$1" [PT] But, if I try it on a CI4 installation in the movies folder and instead of files try to access the methods of dogfood controller, that same rule in combination with codeigniter's .htaccess file produces a redirect, revealing the address https://mydomain.com/movies/ to the user. Is there any simple solution to this issue? Here is the .htaccess file in the subdirectory movies/ where the public CI4 installation files are: Code: # Disable directory browsing
==
Donatas G.
I am not sure if is this what you're looking for!!!!
Code: RewriteEngine On Codeigniter First, Codeigniter Then You!!
yekrinaDigitals
Not sure if this will help, but give it a look at.
Redirect Multiple Domains to Subfolders and Hide the subfolder from URL What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
Thanks everyone for suggestions, but those do not seem to work. I guess I need a very coplex solution here, since there is an interplay of the server root .htaccess file rules, the subdirectory .htaccess file rules and then the configuration of the app itself (like the variable in .env app.baseUrl, which should be different depending on the controller the user tries to access...)
I guess I need to find an apache wizard to make it all work But maybe someone can suggest if it is possible to have different configuration option values of app.baseUrl depending on the route via which the app is accessed? Donatas
==
Donatas G. |
Welcome Guest, Not a member yet? Register Sign In |