Url not found after upload the site to the server - php

I have a problem after uploading my website over test server.
The site is done under symfony, and putting it on my server, the url to access it is the following one:
http://XX.XXX.XXX.XXX/nameOfMySite/app.php
The problem is that I would like to access it with the following URL for example: http://XX.XXX.XXX.XXX/nameOfMySite
because for the moment all the links that I put, like the page of connection, are innaccessible.
In local I do http://localhost/login and not http://localhost/app.php/login
On my server I am forced to do
http://XX.XXX.XXX.XXX/nameOfMySite/app.php/login
to access the page.
Is there a configuration to remove "app.php" or "app_dev.php" please?
I am lost, because apart from the homepage, there is no longer any page of my website is accessible.
Thank you in advance for your answers

I had this issue few days ago. I have solve this changing my .htaccess file. All I ve done was implementing rewrite rule. See below:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php/$1 [QSA,L]
</IfModule>
Hope this will solve your problem too. Good luck

Related

why some asset files are too many redirects in https?

htaccess file:
DirectoryIndex index.php
#Options -Indexes
# enable apache rewrite engine
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA]
I have used this htaccess in root directory. after that all requests are handle index.php. here, some js/jpg files are redirects too many times with https url (https://example.com or https://www.example.com). but in http it works fine.
why this was happen? anybody help to solve this problem.
modernizer.js file redirects like this, (test it from gtmatrix tool result and also developer tools)
https://www.example.com/assets/js/modernizer.js
https://example.com/assets/js/modernizer.js
https://example.com/assets/js/modernizer.js
actually i cannot understand what happens. hostgator linux hosting is used for this. it works fine in http (not https).
suppose if i open in new tab this file then https://www.example.com/assets/js/modernizer.js url is redirect to https://example.com/assets/js/modernizer.js
Finally, I try One solution to solve this issue (this is not exact solution i try only to solve cached file redirects), actually problem occurs due to browser cache memory not in above htaccess. (Preciously I had try in both incognito and cache cleared browser but it still these redirects happens in some files) so i try to change name of these files in above screen shoot then reload it after that this problem is solved.
my guess is this problem is happens due to cache. because previously we used leverage browser caching in htaccess after that this was removed due to solve the problem.
above htaccess is worked fine now.

PHP identifying the URL and displaying page

Currently, a user's timeline can be accessed on my site using localhost/dateapp/timeline?profile=user1571502747. Here user can later manually change their username from user1571502747 to anything they like for easy access. Now what I want is if someone opens localhost/dateapp/user1571502747 (or mysite.com/user1571502747 when live), it automatically redirects and opens the timeline of user user1571502747 or say it redirects to localhost/dateapp/timeline?profile=user1571502747. But I am not being able to figure out a way to do so. Currently, when trying to access that displays no page with page not found browser error. Of course I have haven't put anything for it yet so its natural to get this error. Can anybody guide me on doing this? Facebook does this, for reference. Thanks in advance.
UPDATE: If anything needs to be done in .htaccess file then my current .htaccess has the following.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,END]
You can use .htaccess for this.
Try adding this to your .htaccess file in your root directory
RewriteEngine On
RewriteRule ^([^/]*)$ /timeline?profile=$1 [L]

The requested url not found error in codeigniter

I have created a login page using codeigniter framework.it works well.
After install apachi,mySql and php again my website login is not working.
I can go to "http://localhost/test/" and login button is there.
After The requested URL /test/user/user/login was not found on this server.When I click the login button redirect to the page "http://localhost/test/user/user/login" and it says "The requested URL /test/user/user/login was not found on this server"
How can I solve this?
It works well before I format the computer and install php again.
sloved after changing AllowOverride None to AllowOverride All in /etc/apache2/sites-enabled/000-default .
I have had a lot of problems trying to fix this issue and finally I have figured out that without changing index.php field within the config.php file, you have to specify the address like this; http://localhost/codeigniter_folder_name/index.php?/controller_name
This has solved it for me.
Your .htaccess file maybe inside the application folder. Move it outside the application folder, also ensure to re-write the .htaccess file as follows:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
Why you have used user twice like http://localhost/test/user/user/login. Here, user is the name of the controller. So the url should be like http://localhost/test/user/login. If you are not using htaccess file ie, mod_rewrite is not enabled, then the url should be like http://localhost/test/index.php/user/login

need to change htaccess rewrite code

I have just had a problem with a Codeigniter site where, after the hosting company had migrated files to a new server, I could no longer navigate away from the home page. I Googled a forum with a similar issue and the answer was my htacess file. It was previously like this:
Options FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
and the given solution was to add a '?' character after 'index.php'. I did that and everything then worked OK.
I have tried hard to understand htaccess code and syntax and read many documents but they might as well be written in Chinese for all the sense I can get out of them. So can anyone explain why that additional '?' was needed and what it did? And if you can explain the rest of the code too I would be eternally grateful!
Your new host's php handler or webserver isn't setup to handle PATH INFO, or the stuff after the script (index.php) that's part of the actual path, e.g.
/index.php/this/is/part/of/the/path_info
The index.php script is executed, and everything after can be fetched via "PATH_INFO". If the server doesn't handle this, code igniter can optionally handle the path passed in as the QUERY STRING. Which are parameters that follow a ?.
None of this has anything to do with htaccess or mod_rewrite. It's just the way URLs and handlers work.

TinyMCE / Tinybrowser upload tab giving a 404

Just looking for a bit of help with Tinybrowser - I've tried updating it to the latest version but it's still failing. If I click the 'Upload' tab I get a 404.. I'm thinking it's possibly to do with the htaccess, but I'm not too hot with htaccess rules so I can't pinpoint it.
If I visit the page directly (/admin/javascript/tiny_mce/plugins/tinybrowser/upload.php?type=image&tokenget=315af6ee7cf85bc6170760a0c1a5b86d&folder=) I get a 404 as well. If I take off 'folder=' it'll go to the page, if I make it follllder=, it'll go to the page. So for some reason 'folder=' seems to be causing problems. Even if I manually put in a string for the folder var.
The htaccess is as follows:
# default
Options All -Indexes
RewriteEngine On
RewriteBase /
# Make sure there's no way of getting to this file
<FilesMatch "\.htaccess$">
Order deny,allow
Deny from all
Satisfy all
</FilesMatch>
RewriteRule ^login(/*)$ system/login/ [L,QSA]
# Route all other traffic to index.php (front controller)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?_args=$1 [L,QSA]
AddType text/x-component htc
If I remove
RewriteRule ^(.*)$ /index.php?_args=$1 [L,QSA]
I end up getting a 403 forbidden error, but obviously it's not really feasible to remove this line anyway.
Thanks in advance guys
I just ran into this as well.
The problem appears to be a security restriction on some servers that relates to the filename of the PHP file, as well as the "folder=" querystring.
I got around it by renaming upload.php to upload_tab.php, and then modifying tinybrowser.php to reference the upload_tab.php file:
if($tinybrowser['allowupload'])
{
?><li id="upload_tab"><span><?php echo TB_UPLOAD; ?></span></li><?php
}
This allows you to see the upload window, and submit some files using POST variables.
However, a problem remains...
The particular server I came across also has a similar restriction on a request to upload_file.php with a querystring of 'folder='. There isn't an easy fix for this, apart from decompiling flexupload.swf (which I tried, but couldn't recompile it) so I couldn't fully resolve the issue.

Categories