drupal:object not found error on every link other than home page - .htaccess

After installing and configuring drupal 8 site,home page in displayed perfectly,but when i navigate to any link Object not found error is thrown.I am using xampp.Writing RewriteBase /drupal in /sites/default/files/.htaccess file didnt fix the error.AllowOverride is all in directory lampp/htdocs/.What am I doing wrong?

I think, drupal missed to place its default htaccess file in the drupal root folder. I fixed the same by copying the htaccess from the drupal zip file and placed it in the root folder. Also make sure mod_rewrite is also enabled in Apache Configurations.

If you are using Linux for server then execute below command.
sudo a2enmod rewrite
sudo a2enmod env
sudo a2enmod dir
sudo a2enmod mime
It works in my case.

Related

Why don't my clean URL's work in Drupal, even though rewrite_module is present?

Hey guys. I'm asking this question here as a last resort, since I've been trying to solve the issue for almost two days now.
I'm trying to enable clean URL's on my Drupal web application. I have visited several public questions such as this one, but to no avail. My sincerest apologies if this is thus a repost.
Some (relevant) context:
The project involves automatically setting up a VM using a Vagrant script.
The VM has no GUI.
Vagrant uses VirtualBox.
Vagrant uses bento/centos-7.9 as a base box.
I use WSL on my physical device whenever I need a terminal for PS or Linux commands.
I'm setting up a LAMP stack on the VM using the following:
CentOS 7.9, as mentioned up above.
Apache 2.4.6, as in:
yum -y install httpd
MariaDB 10.5.9, as in:
wget https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
chmod +x mariadb_repo_setup
./mariadb_repo_setup
yum -y install mariadb-server
PHP 7.4.16, as in:
yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum-config-manager --enable remi-php74
yum -y install php php-mysql
I'm storing the extracted contents of Drupal (index.php, update.php,
core, sites ...) under /var/www/drupal/. I have given Apache
recursive ownership of that folder as to not create a hassle having to set up permissions. It's not a production project anyway.
In the /etc/httpd/conf/httpd.conf file, I have only touched the
DocumentRoot, which I set to DocumentRoot "/var/www/drupal". I do not want to use .htaccess.
When I run httpd -M | grep rewrite, I receive the output rewrite_module (shared). When I run phpinfo(); on a test page, mod_rewrite is present among the loaded modules.
Running the application, everything goes fine, and the following output is produced:
Drupal warnings top part
Drupal warnings bottom part
I'm aware of the other two warnings, but those are a worry for another day. When I continue despite the warnings, Apache loads index.php just fine:
Screenshot of index.php
However, the moment I click any button, this happens:
Screenshot of yet another problem
I suspect this is a consequence of the clean URL's not being enabled. However, as far as I know, all necessary modules have been installed.
What I have tried so far:
In /etc/httpd/conf/httpd.conf, trying everything that's suggested here.
In /etc/httpd/conf/httpd.conf, setting every AllowOverride option to All.
Checking for compability issues.
Moving the document root around.
Much more...
Help would be greatly appreciated. Many thanks in advance. If you require any more information, I will respond as soon as possible.
Hey guys. The issue has been solved.
Somehow, it suddenly works. I am now able to navigate the website without a Not Found error popping up.
I retried a method that didn't work before, but now it does. There was no change in any other variables. I edited /etc/httpd/conf/httpd.conf. Besides already having changed DocumentRoot to /var/www/drupal, I also added another piece of configuration right under that:
<Directory "/var/www/drupal">
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ index.php [L]
</Directory>
I obtained this information from here.
The CLEAN URLS warning is still present though:
Drupal warnings top part
But there seems to be no problem when continuing despite the warnings. In fact, in the application itself, navigating to the errors/warnings section, the CLEAN URLS warning isn't even there!

Cannot copy contents of Wordpress directory to the web server root

I'm a total newbie at this!
I have a virtual machine running Debian 9. I have LAMP installed.
I am following the instructions at this link to install WordPress:
https://www.adminbyaccident.com/gnu-linux/how-to-install-wordpress-on-debian-9-lamp-stack/
I am now at this step:
We now copy the contents of the wordpress directory to the web server root.
albert#debian:~/wordpress$ sudo cp -a ~/wordpress/* /var/www/html
[sudo] password for albert:
albert#debian:~/wordpress$
However, when I try this (I don't use "sudo" because it's not installed on Debian by default), I get the following error message:
Someone please help me!!!
Thank you so much.
It looks like the wordpress directory is not in the root directory.
Did you cd somewhere after downloading? If not, the wordpress dir should be at your current dir which is /home/lanalee/.
Type in ls to list all files in /home/lanalee/. If the list shows a directory named wordpress, you can continue with the following command:
cp -a ./wordpress/* /var/www/html
I replaced the ~ which points to your systems root directory with a . that refers to the folder your currently in.
If there is no wordpress directory listed, please type ls ~/ and share the output with us.

How to change NGINX install location Ubuntu 14.04

My aim is to change directory of NGINX installation to run as a web server. Motive - custom compiled NGINX, with functions which doesn't come with standard.
I've compiled NGINX from source and as was suggested on this page, all configuration was pointed in the new location /usr/local/nginx when compiled. Default installation is at /usr/share/nginx.
After starting the service, NGINX still runs on the default installation.
I've tried to load nginx with new configuration nginx -c /usr/local/nginx/nginx.conf which breaks everything, returning error 404 for index.html.
Multiple attempts at searching, only shows up with changing site directory.
Is there a solid solution to specify from where NGINX loads?
Edit:
As suggested by John Ankanna below, the following fixed it:
sudo mv /usr/share/nginx /usr/share/nginx.bkp - just renaming the
directory to recover current setup.
sudo ln -s /usr/local/nginx /usr/share/nginx - create symlink in place of original.
Debian/Ubuntu use a standard directory hierarchy. The command man hier will describe this for you. It is common for packages to create symlinks to place files in the correct place when the program expects them elsewhere.
Try Creating Symlink
sudo ln -s /usr/share/nginx /usr/local/nginx

Magento 2.0 first installation on shared hosting

I have installed/reinstalled my first magento 2.0 on one of my shared hosting server. I followed installation guide from magento devdocs. Everything seemed to bo ok, but when I visit site I dont see any images, css, scripts running in the background.
Ok, it must be .htaccess, I check my configuration, it seems to be ok, then I inspected elements and saw 403 errors,
dev.testing.com/two/pub/static/frontend/Magento/luma/sl_SI/Magento_Theme/favicon.ico
403 (Forbidden)
ok check .htaccess again, then I check in the file manager and saw all those files missing, can someone give me a hint what am I missing, doing wrong for the past days?
you can try these commands
your Magento install dir/
bin/magento setup:static-content:deploy
after these commands you have to give permission to var and pub folders by using
chmod 777 -R var
AND
chmod 777 -R pub

How to Install OpenCart in subdirectory?

I have a godaddy web hosting, with more domains. Let's say shopping.com points to shopping folder. After installing OpenCart I can see no .htaccess.txt file in order to edit RewriteBase /. And while accessing the web page it redirects me to install which lets me upgrade. I tried downloading a default OpenCart .htaccess file from web, but then I get 403 error. Anyone knows what could be the issue?
I had to chmod 755 .htaccess as the server did not have access to the file.
Hope it helps someone else to solve their issue.

Resources