Drupal 9 only homepage - drupal

I'm very new to drupal and don't know anything about it. I'm, using OpenServer witha PHP 7.4, Apache 2.4, MySQL 5.7. I'v estracted everything into c/OsPanel/domains/cms/Drupal/freshmart/ (I have installed wordpress in c/OsPanel/domains/cms/WP/restaurant and everything works as it should. When I go to cms/drupal/freshmart, I have login page, I login and go to welcome page. When I try to acces anything else like structure, appearance and etc, I get "Page not found" and url is cms/drupal/freshmart/admin/content. In folders, there is no such folder as admin, but from what I know there shouldn't be it.
If you are using a temporary URL such as 192.168.0.42/~username because the domain has not been transferred yet or has not propagated yet, you would have the problem described above until the domain name is transferred over.
To be able to use Drupal before the domain name points over, you will need to change something in the .htaccess file:
Modify the RewriteBase if you are using Drupal in a subdirectory or in a
VirtualDocumentRoot and the rewrite rules are not working properly.
For example if your site is at http://example.com/drupal uncomment and
modify the following line:
RewriteBase /drupal
If your temporary URL is something like 192.168.0.42/~username then you will need to add the following line in .htaccess:
RewriteBase /~username
Once you point the domain name over to the website, be sure to comment out or delete that line.
I saw this on one of the forums, and I think it could be my problem. But I don't understand what should I write in RewriteBase/.
On server mod_rewrite is enabled, there is a .htaccess. What should I do?

Related

Multiple RewriteEngine calls, or another way to solve this problem?

I have Wordpress multisite installed at the root of my site (the Wordpress files are actually in /wp, but it's configured so that each subsite URL is at the root - eg. /site1, /site2 etc.) This means that there's a Wordpress section in my .htaccess file that I probably shouldn't be touching, because Wordpress might overwrite those changes.
However! There is a redirect I would like to build, from (say) /path/to/oldsite to :8080/newsite, and I don't know how to do this without RewriteEngine. Other redirects I have managed to do basic 301s with, but I don't know how to redirect to a different port that way. My test attempt to have multiple sections that use RewriteEngine didn't work since apparently only the final RewriteEngine section gets heeded?
Anyway, that's my issue. Any suggestions for the best way of building this redirect? Am I just going to have to create empty directory /path/to/oldsite to put a redirect in?
Thanks!

Wordpress redirect to subdirectory - wp-admin forwards to wrong login url

I moved a Wordpress site to a new server. The site is installed in a subdirectory and the .htaccess in the root forwards to it like so:
RewriteEngine On
RewriteCond $1 !(^wpfolder/)
RewriteRule ^(.*)$ wpfolder/$1 [L]
I've changed the site_url and home entries in the wp_options table in the database. Everything is working fine - except if I visit site.com/wp-admin to login - it redirects to the login page like so:
site.com/wp-login.php?redirect_to=http%3A%2F%2Fsite.com%2Fwpfolder%2Fwp-admin%2F&reauth=1
(notice the 'wpfolder' in the redirect_to value)
When I enter the correct username and password, nothing happens and I get the login box again. I can log in no problem by visiting site.com/wp-login.php - but I'd really like to solve this redirect problem if possible.
I found a solution that worked for me. Update the site url to site.com/wpfolder
if you are having problems doing that, you can put define('RELOCATE',true); on you wp-config.php file and it would do it for you. The admin and login links will be site.com/wpfolder/wp-admin but on the site itself the url are all relative to the root (site.com/about) and I think it is the correct behavior of this configuration
Hope it help
This problem often occurs when moving WordPress.
I use a plugin called duplicator when moving sites. It's great for moving test sites to their live server and much more.
Just search Duplicator inside the plugins section of the back end.
https://wordpress.org/plugins/duplicator/
The plugin takes all files and also the database as a backup for you to install on a new server or even just move to a different directory.
When you have downloaded the files duplicator provides you can upload installer.php and backup.zip to the new server or directory.
Run installer.php and enter the new database and website details in the prompts.
Let the plugin do it's stuff.
After it is complete there will be no problems with any area of the site.
Although it seems like a long process it rarely takes more than 5 minutes depending on how many files the WordPress build contains.

How to access Wordpress admin panel after integration with Codeigniter?

In the company where I work we used to have Wordpress on its own subdomain, like blog.ourwebsite.com. We decided that it would've been better to have it in the main domain, like: ourwebsite.com/blog. Also, we want it perfectly integrate with our current design, so the blog should load inside the website showing just the posts, while the header and the footer will be the one of our website. Our website is built with Codeigniter.
I've read different articles and questions about how to integrate the two platforms and in the end we opted for putting Wordpress inside the root directory of the Codeigniter installation, so that it looks like this:
ourwebsite/
application/
system/
wordpress_blog/
In the Codeigniter index.php I am loading Wordpress with this instruction:
require_once './wpblog/wp-blog-header.php';
I put it on top, so before loading the codeigniter core. At this point the only problem was the site_url function conflict which I solved by renaming it in Codeigniter. So, everything seems to work fine except that I have no idea how to access the Wordpress administration panel.
I then created a blog controller and I can now call Wordpress functions inside the Codeigniter view. So at this point the Wordpress content is displayed correctly. The problem is that I have no idea how to access the Wordpress admin panel. If I try to access localhost/ourwebsite/en/blog/wp-admin I, of course, get an error, because it's trying to access a wp-admin function inside the controller, which doesn't exist. So I was thinking to access directly the directory with something like localhost/ourwebsite/wordpress_blog/wp-admin (wordpress_blog is the name of the directory on disk, which is different from the controller name), but I get a 404 error. I also added this directory to the Codeigniter .htaccess file that now looks like this:
RewriteEngine on
RewriteBase /ourwebsite/
RewriteCond $1 !^(index\.php|wordpress_blog|cache|captcha|fonts|forum|media|img|min|css|js|scripts|images|uploads|docs|robots.txt|sitemap.xml|sitemap|public|tools|assets|xd_receiver.htm)
RewriteRule ^(.*)$ index.php/$1 [L]
Any idea?
EDIT:
I tried accessing directly the wp-login.php file, at http://localhost/~carlo/ourwebsite/wordpress_blog/wp-login.php. This actually works. The thing is that when I try to login it redirects me to a wrong url, which is: http://localhost/~carlo/ourwebsite/wordpress_blog/wp-admin/localhost/~carlo/ourwebsite/wordpress_blog/wp-login.php?redirect_to=http%3A%2F%2Flocalhost%2F~carlo%2Fourwebsite%2Fwpblog%2Fwp-admin%2F&reauth=1.
The thing is that it logged me in anyway, so if I try to access the admin panel again, now, it kind of works. I can see it but it's like it has no css or javascript files loaded.
ok then try to change the wordpress siteurl in option table. it should be like localhost/ourwebsite/wordpress_blog/..
and check your
localhost/ourwebsite/wordpress_blog/wp-admin
edited 2/11/2014
define('WP_HOME','http://localhost/~carlo/ourwebsite/wordpress_blog/');
define('WP_SITEURL','http://localhost/~carlo/ourwebsite/wordpress_blog/');
you are missing "http://"

Migration of Wordpress sites to a local WAMPserver, now the pages cannot be found

Recently at our agency we needed to do a serious overhaul of our servers, so I've had to migrate the sites onto a local host machine so that I could work on them in the meantime. I used WAMPserver to host the sites, and the sites are powered by Wordpress. When the move was complete, I checked the sites on my local host to see how they looked. The front pages looked perfectly fine, but whenever I tried to navigate to the inner pages, I was met with nothing but 404s. My supervisor believes it might be connection issue, but I wanted to check here first to see if anyone else had similar problems.
OS: Windows 7
WAMPserver version: 2.2
Steps already taken
I made sure that the local databases were named exactly as they were on the original server, and I double-checked with the wp-config file.
I made sure to obtain the SQL files for the databases and imported
them in phpmyadmin.
I went into the SQL files and changed all of the links (changed all instances of http://www.sitename.com to http://localhost/sitename)
I logged into the Wordpress admin dashboard to check if all of the content was actually there. Everything was intact, but even clicking on "view post/page" on each individual post/page resulted in a 404.
I tried returning the permalink options to default and then changing them back, but that didn't work.
Unfortunately, I cannot provide any more information as I am no longer in the office. I hope that I can receive some help by the time I go back in tomorrow morning.
It sounds like an issue with mod_rewrite. Try adding AllowOverride All to your virtual host.
If that doesn't work then also check your httpd.conf for the following line
LoadModule rewrite_module modules/mod_rewrite.so
Make sure it's not commented out.
In my case I migrated from example.com to localhost/example when this error started showing up. mod_rewrite was on. What I had to do was edit .htaccess and change the last line in the block <IfModule mod_rewrite.c> (line 8 for me) from this
RewriteRule . /index.php [L]
to this
RewriteRule . /example/index.php [L]

Wordpress in same directory with default page

I think I'm needing help with .htaccess here.
I have a page that was named index.php. I still need that to be the default page but with a new name AND I need a wordpress install in the same root. So here's what I've done:
Renamed index.php to somethingelse.php
Created an .HTACCESS with this line in it: DirectoryIndex somethingelse.php
Now if I go to www.site.com it brings up the www.site.com/somethingelse.php page (as it should).
Next I installed Wordpress into the root. That went well too.
The problem is I cannot access wordpress via www.site.com/index.php when I do that it just kicks me back over to somethingelse.php page
I'm thinking there is something I need to add to .htaccess so that if:
1) Someone types www.site.com it goes to www.site.com/somethingelse.php
2) Someone types www.site.com/index.php it goes to the wordpress install
Just for clarity, the reason for this is that in about a week, somethingelse.php will go away and the wordpress install will be the live site.
Any help is appreciated
I fixed it by creating a separate page that only I can get to to set and destroy a cookie. then in the header.php of the WP file I check that cookie and determine where to go.

Resources