The requested URL /apk-download/ was not found on this server - php

I have migrated one of my client's sites to Linode. Now the homepage is working and the rest of the pages shows "NOT Found" and "The requested URL /apk-download/ was not found on this server."
Apache/2.4.25 (Debian) Server at www.frpbypass.us Port 80
URL: [http://www.frpbypass.us][1]
I have tried to change:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Also, added the WordPress default .httaccess.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
After making the changes, I have restarted the Apache web server as well as Server reboot.
Any idea of how to fix?
Thanks in advance.

Simply go to setting -> permalink and change your default permalink setting twice.
It will change the default htaccess and your site will start working.

Finally, I am able to fix the issue. If you're experiencing the same issue then first just saving the Permalink should fix the issue. If not then try .htaccess method and finally looking for apache2.conf file.
In my case, I made all the changes as above but enabling the apache2 rewrite mod fixed my issue.
Use this command:
sudo a2enmod rewrite
Hope this helps anyone who faces the same issue. It took hours of research to finally fix the issue.

Related

How to get rid of index.php in url with Wordpress Rest API

I have correctly setup my site locally and everything works. However, when I deployed that to a blank EC2 instance, I see that wp-json (Rest API) does not work. It works only when I put an index.php in between. In other words
This works locally:
http://localhost/wordpress/wp-json
But I need to have this on the EC2 server to make it work.
http://A.B.C.D/wordpress/index.php/wp-json
On the server, I have installed apache2 and I have not messed up with the configs yet. I am familiar with wordpress but I not so much familiar with config tweaks on apache. I have also gone thru thousands of previously posted questions, but none of them seem to answer my problem.
First, you need to have by a2enmod rewrite in your terminal.
Then in your Apache Configuration file, make sure you have the following:
<Directory #Wordpress directory here#>
Options Indexes FollowSymLinks
AllowOverride All #allows .htaccess directives in the next step
Require all granted
</Directory>
Then make sure you have the following content in your root .htaccess file:
RewriteEngine On
RewriteBase /wordpress/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.+) index.php/$1 [L]

Wordpress site getting 404 if "Permalink" option set to "Post name"

I have a rather strange issue with my website. I have just decided to remove my website from one server to a new server (I no longer wanted to use wpengine.co.uk)
I have now got the site up and running however the only issue I have is if I set the "permalinks" option to "post name" as can be seen here: http://i.imgur.com/poyRQ9x.png then I get a 404.
I have the following Apache setup on a Linux box:
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
My .htaccess looks like this (for now I have set the file permissions to 666):
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Lastly I have enabled as can be seen from my "phpinfo()" page.
The site does work if I use the ugly looking "plain" option... but that is obviously something I don't want.
Reboot Apache after making changes to httpd.config. (Changes to pph.ini and .htaccess don't require reboots).
And, you may need to add AllowOverride All for the document root:
<Directory /var/www/html>
# ... other directives...
AllowOverride All
</Directory>
Please remove your .htaccess file from wordpress root directory, then try to change permalink setting.
Note :- backup .htaccess file before delete it.
I hope this will work for you.
Well the answer turned out to be rather strange. It appears that for this to work I needed to install some extra PHP extensions. All I needed to do was:
sudo apt-get install php-mbstring php7.0-mbstring php-gettext
Although I think that the one that finally worked was:
sudo apt-get install php-curl
I saw warnings about this but I had no idea that that would actually stop WordPress's redirection. If somebody knows why this is the case I'd be really grateful to know.

WordPress: The requested URL /myPost/ was not found on this server

I installed wordpress and configured and I wrote a post and publish the post but I get this error:
"The requested URL /myPost/ was not found on this server."
I modify my httpd.conf file and I add:
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
and I also add .htaccess in my web root directory:
RewriteEngine on
<IfModule mod_rewrite.c>
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
and restarted apache. But now I'm getting the following error:
Oops! That page can’t be found.
Any of you knows what is wrong or how can I fix this to able to see my post in wordpress?
I'll really appreciate you help.
The issue is caused due to the permalinks now set correctly.
Perform the steps
1) delete the .htaccess file - WP will create it automatically
2) Change the permalink settings
WP site pages and posts works fine

404 not found , the requested URL <<url name>> not found on this server in wordpress

I recently installed wordpress , I am facing issues when I try to change the permalinks format ,
when I change the permalink from default to day and time
Default http://127.0.0.1/?p=123
Day and name http://127.0.0.1/2015/03/16/sample-post/
the link generated does't working , it gives the same error 404 all the
time ,
The requested URL /2015/03/16/post-5-problem/ was not found on this server.
But when the permalink type was default this works perfectly.
I found some solutions which are
sudo a2enmod rewrite
Module rewrite already enabled
Another solution is to change the mode permissions of .htaccess file to 666(giving write permission to wordpress of .htaccess file) before change the permalink from default to some other type ,
sudo chmod 666 /address_of_.htaccess
i checked the .htaccess file
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
but the above seems to be correct , the above included by the wordpress itself
Both the solutions does't seem to work , is there any other thing do I have to change to enable the permalink options ?
If it is a fresh install of web server it is possible that .htaccess rules are not allowed by default. To fix that, edit you httpd.conf (usually it is in /etc/apache2), find
<Directory "path/to/your/document/root">
# ....
AllowOverride None
# ....
</Directory>
and change
AllowOverride None
to
AllowOverride All
Then restart your web server and try again.
Reset your desired permalink from wordpress admin area and add this code in htaccess:
# BEGIN WordPress
<IfModule mod_rewrite.c>
ErrorDocument 404 /index.php?error=404
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Now, check with blog posts and pages.
Thanks,
You can go to preferences -> services & ports and you need to check enabled ssl for Apache
It's working for me
You are receiving this error because your webserver cannot find the file, and it's not passing the request to Wordpress.
You need to add rewrite rules for your Wordpress, and instructions for that depend on your webserver software (Apache, nginx, etc).
Example with nginx:
location / {
try_files $uri $uri/ /index.php?$args;
}
Which literally means: try to open "/2015/03/16/post-5-problem/" in filesystem first, if it doesn't exist try to add a slash, if that doesn't help pass the request to index.php (which is Wordpress main file) with the arguments.
Enabling rewrite module is not enough, you have to add rewrite rule(s).

WordPress not working with .htaccess

Have been around the houses with this - have read many htaccess issues etc - and still can't seem to get this to work.
I have a WordPress site installed at var/www
I wanted to have a specific URL point to a specific page. Started by browsing some WordPress plugins. None of them worked so I just went straight to the source and started editing the .htaccess file in the root of the WordPress installation. This is where it started getting frustrating.
One of the many attempts at an .htaccess file:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
Options +FollowSymLinks
Redirect 301 /redirect-me http://my-wordpress-site/?page_id=15
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
All attempts at a Redirect have resulted in 404 Not Found errors.
I have asserted the following things:
Apache2 Rewrite Module is enabled
www-data has both read and write access to the .htaccess file.
AllowOverride is set to All in the apache2.conf file for the directory
Here's a big clue for you: swapping the last ReWrite rule within my .htaccess file does absolutely nothing to my WordPress site...
RewriteRule . /poo.php [L]
Any other suggestions for debugging a failing .htaccess file?
When you make configuration changes such as AllowOverride in the config, make sure your do a restart on Apache2 so the changes become effective. Give that a shot.

Categories