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.
Related
This website was in one server, and that server failed, so an automatic backup has made. the problem is that now it looks like a lot of files are missing, if I check the console in the browser there is a lot of 404 errors, and the requested URL is wrong.
Is there a kind of configuration file in which I can set the url that wordpress should use to request the files?
Update:
Only the .js, .css and .png files are wrong requested, the .php and .html files are fine.
It may be an issue with the trailing slash into the home URL and site URL. The URL should be "example.com". Add the slash in the last of the website URL.
Try with adding a trailing slash in the site URL and home URL.
I fixed it, the file I was searching for is wp-config.php, and the line that did the trick is
define('WP_SITEURL', 'http://example.com');
I don't know what was the problem, but I basically solved it overwriting that config variable.
I am working on a website that has many directories and subdirectories. Developing locally, I am running php's built in webserver. I really like the way this handles 404s in that if a 404 is found, it serves the parent directory, but maintains the url so that I may parse it and perform some task.
For example:
Given: dir4 does not exist
localhost:8000/dir1/dir2/dir3/dir4/
This URL will return the index.php found in dir3, however the URL will remain the same, and I can use dir4 to determine some login on the dir3 index file (looking at $_SERVER['REQUEST_URI']).
The behavior is also outlined here.
When I move my project onto my webserver, this did not work.
I've tried the solution posted here but it removed the "dir4" part of the URL.
I am hoping to recreate this functionality via .htaccess. Has anyone successfully done so?
At the moment I am trying to move a website to a new web server. The site uses CodeIgniter and on the old server, every route worked. On the new server none of them are working, even though I copied the entire website from the old server. This means there are no differences in .htaccess files, since the two servers contain the exact same website. Not even the default routes are working, just the home page (index.php). I included the code in .htaccess to remove 'index.php' from routed URLs, but that also does not work.
If I try to visit '1.1.1.1/~user/employees' it will give me a 404 error, which means that the CodeIgniter route is not working. The controller file is located at /application/controllers/employees.php, so I am not sure what causes the problem.
I am aware of the similar posts on the site here, but none of them could solve my problem. Configuration of the config/config.php is (partly) as follows:
$config['base_url'] = '1.1.1.1/~user';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
I have tried to change the base_url, but it still does not work if it's empty. Changing uri_protocol to REQUEST_URI or PATH_INFO also does not work. Also, if I try 1.1.1.1/~user/index.php/employees (so put 'index.php/' in between) I still cannot reach the page. I checked some Apache settings as well, AllowOverride is set to ALL and the mod_rewrite module is installed and enabled. Is there perhaps something else concerning differences in both server's configurations that I could have missed?
EDIT:
I think I am a bit closer to finding out what the problem is. It is either something with Apache or .htaccess (but I already tried many things) or it has to do with the fact that the server URL is 1.1.1.1/~user rather than 2.2.2.2 as it was on the old server. Maybe I should change the baseurl or location of my .htaccess? This looks similar to my problem, but moving the .htaccess did not fix the problem: Url routing errors in php in codeigniter. I might try re-installing Apache.
I think that you firstly should find out what happened.
All requests to CI go through index.php, so you just echo something and exit in index.php file at the first line.
If the page display what you echoed that means there is something wrong in CI, otherwise that's not because of CI. And you can focus on what cause the problem.
Sorry about my English.
I installed OpenScholar in my domain:
http://scholar.web
Basically, when someone register for an account, his site URL is http://scholar.web/user, and his content will be at http://scholar.web/user/contents
I've been searching a way so that the URL is converted into: http://user.scholar.web/content for displaying his content via virtual subdomain (htaccess maybe)
Anyone can provide some solutions or guidance?
thanks
First of all, you'll need to change the DNS entry on the domain so that *.scholar.web points to your site.
Afterwards, (If you're using Apache) change the Apache vhost to accept *.scholar.web requests.
You can then use htaccess and/or PHP to do what you like with the URL formatting.
I used to have a domain called something along the lines of "iscool.com".
This is the method I used so I could use pseudo subdomains like "ben.iscool.com" and it would display content accordingly.
I just moved a develoment site onto a test production server and I'm testing some things out.
When you go to the root URL (ie rooturl.com), the browser is correctly rendering rooturl.com/index.php without showing the index.php in the address bar.
However, I also have a directory at rooturl.com/admin that also has an index file of index.php, but when I go to rooturl.com/admin I'm getting a 404 not found error. But if I type out rooturl.com/admin/index.php, it loads the page.
Is there a common reason for this?
The last piece of relevant information is that since my client won't switch their domain name to the new host until they are ready with migrating email, etc., I'm currently not able to view the site on the registered URL, I can only access it using the IP address directly which I got from the host.
My gut feeling is that the direct IP address is screwing with how it would normally work, but it's just a guess and I have no idea why that would be the case.
Sounds like it could be an .htaccess rewriting issue. Be sure to check any .htaccess file (hidden, by default) in those directories for any screwy rewrite-rules.
If you're running a MVC project, then the url /admin may be confused for a call to a controller rather than a directory.
My first shoot is that you have .htaccess file and it is redirecting everythind to your root index.php file.