Drupal 7 - change index.php as a default main page - drupal-7

I'm trying to work on my new website Drupal7 while I'm keeping in the hosting my old static website. So I have:
index.html (static website. I want to keep for my users)
index.php (drupal new installation)
Is there a way to set in drupal this kind of situation?
The problem, as you problably can see at this point, is that every time I'm going to a different section I'm being redirected to the .html homepage.
I mean for example the admin section is: www.mydomain.com/?q=admin instead of www.mydomain.com/index.php?q=admin
What's the easiest way to keep the html static web for my current users while I'm developing my drupal7 website in the "background"?

I got a solution finally:
DirectoryIndex index.html index.htm index.php
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} q
RewriteRule ^(.*) index.php [L]

Related

Sonata admin missing css files

Working on a site with php 7.2, Symfony 4 and Sonata admin 3.
In dev, on my machine, everything works fine, the site itself, and the two admins (user and content).
I have put everything on the final server (unfortunately, file by file, no console with S4 ! so, no "composer:install"...).
Still on dev, the site works fine, all functionalities.
But when I try to use the admin page, I only get a non-formatted page. None of the assets (css and js) seems to work!
However the source code are identical, on localhost and the distant site...
Can anyone help me
Edit : I found where the issue comes from : it's linked to .htaccess.
The http address I use ends in /public/index.php. I use .htaccess to shorten it and when using the .htacces redirection I can't get the assets of the admin page, while it works fine without redirection.
Is there something I should change in my .htaccess code ?
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ public/index.php
</IfModule>

ImpressPages admin page has 404 error

I have just installed ImpressPages 4_0_17 and I completed the installation process through the point of filling out the database form and submitting it. The next page gave a 404 error on the URL /ImpressPages/admin. Prior to that, the systems check page listed 3 warnings: Magic quotes Off, Apache mod_rewrite, PHP memory limit 64MB. No other info on these warnings was available on that page.
I am using the alias feature on GoDaddy for hosting, which allows me to create multiple websites in the same account. In addition, I am using a sub-domain for this install so I can test it out before replacing the original site. Because I uploaded the entire IP zip file and extracted it in the web root folder, all the IP files are now installed in the folder /ImpressPages.
After the 404 error, I altered the URL to be just /ImpressPages/. That actually loaded fine. In addition, a small dialog popped up saying that I had been automatically logged in as admin. It gave me the username, password and the email I configured for the site. It also provided the admin page URL that produces a 404 error and said I needed to go there to login in the future.
The home page at /ImpressPages/ loads and shows inline editing features. If I click the Lorem Ipsum link, /ImpressPages/index.php/lorem-ipsumy, I get a white page with the one line:
"No input file specified."
I have tried a few tweaks to the .htaccess file with no success. The latest active lines are shown below. All the other lines from the default file are commented out and I have not tried messing with them.
<IfModule mod_rewrite.c>
RewriteEngine on
# Attempt to fix SVG images, 6/4/2014
AddType image/svg+xml svg
AddType image/svg+xml svgz
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /ImpressPages/index.php?%{QUERY_STRING} [L]
# Redirect www urls to non-www.
# RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
# RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
</IfModule>
The changes I attempted to get admin access are in the RewriteRule. I prefixed index.php first with a slash, then with /ImpressPages/. Neither one helped. Any suggestions on how to get admin access will be greatly appreciated.
17:11 - New info:
With the /ImpressPages/ path and the following .htaccess lines enabled, I can now get the login dialog on the admin page. Once I enter the login correctly, the next URL is /ImpressPages/index.php with the white page described previously. Then reloading /ImpressPages/admin produces the same white page and the same /ImpressPages/index.php URL. So now I can login, but it doesn't help.
Options -Indexes
Options -MultiViews
Those lines are in the default .htaccess file already. I just removed the comment character to activate them.
17:45 - more progress.
I moved all the contents of the /ImpressPages/ folder up one level to web root. Then I removed /ImpressPages/ from the path for index.php in the rewrite rule. With that one change, admin login started working and I am now able to edit my site. There are still issues. For example, publishing a page does publish the changes, but then loads the typical white page with the URL /index.php/home. The URL / loads the home page correctly. Almost sounds like the URL routing is not working correctly.
It looks like ImpressPages instal decided your server doesn't support URL rewrites and has placed rewritesDisabled in config.php
Try to remove this config line.

redirect to subfolder and then hide subfolder from url

i have a url: www.example.co.za.
when i go to that url i can see my directory structure. This is my document root and needs to remain my document root so that i can access all underlying folders.
inside my document root i have the following folders. "auction","common".
auction contains "www" folder which is where my index.php file is.
My goal is to access example.co.za and then it must load "/auction/www". My url will then be "www.example.co.za/auction/www/index.php" but i dont want "/auction/www"in the url.
Can someone please help me with this. i suck at htaccess :(.
I dont want linked folders, other vhosts etc. I just need what i explained above.
Try:
RewriteEngine On
RewriteRule ^(index.php|)$ /auction/www/index.php [L]
This may now be the "definitive" answer or the "best way" to do it because .htaccess isn't my strongest area, but something like this should get you on the right path:
Be sure to put this in the .htaccess file in the root directory.
RewriteEngine on
RewriteBase /
RewriteRule ^(.*)$ auction/www/$1 [L]
You can expand on this with alternative paths for a multi-app site, eg:
RewriteEngine on
RewriteBase /
RewriteRule ^auction/(.*)$ auction/www/$1
RewriteRule ^otherthing/(.*)$ otherthing/www/$1 [L]
etc.
So in the second example when you go to www.mysite.co.za/auction you'll be redirected to the content in auction/www, and if you go to www.mysite.co.za/otherthing you'll be redirected accordingly.
EDIT: added second example

cakephp app as part of static site

I have kind of an unique situation.
I have developed a cakephp app and need to deploy it to a shared server with content.
I know generally we are supposed to have static content in webroot, but am not allowed to do so, as this application needs to be removed later on.
its a shared hosting and i can't change DocumentRoot or any admin related settings. I can however add .htacces files.
I have my files in the following order:
/webapp
/app
/lib
...
/webroot
I guess you get the point.
I was planning to deploy the entire 'webapp' folder along with the static site and have the login link so the people can come to the site as http://mysite.com/webapp/users/login.
Unfortunately I do not know the correct way to do this. I hope to preserve the directory structure as-is so that someone coming after me can easily modify and delete it.
Any help is appreciated.
UPDATE:
I forgot to mention that locally i used to access the site by http://localhost/webapp, which was based of a DocumentRoot/VirtualHost setting. I might not be able to do that on prod, so how can I translate that using routes?
You need to update the .htaccess files to reference /webapp/app/webroot/ instead of /app/webroot/.
Although I’d be tempted to just install the CakePHP app in the root of your web server’s publicly-accessible directory, use CakePHP’s built-in PagesController to serve the static files, and just remove the controllers as and when you need to.
If you want to serve CakePHP from a subdirectory using Apache, you're looking for the RewriteBase directive. Add the directive to each of your three .htaccess files (in CakePHP root, in app, and in app/webroot). For example, the root one will end up looking like:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /webapp
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
Now Cake will be happy being served in your webapp subdirectory.

Setup subdomain in new app directory with Cpanel cakephp

I have working domain.kz with cakephp (Cpanel hosting)
www/app
www/cake
www/index.php
how can i setup admin.domain.kz to (app2)
www/app
www/app2
www/cake
www/index.php
The way you want it - will be very difficult; you'll have to change several file/folder paths in several places. Instead, why don't you try to create an admin folder where you've the full cakephp application for admin.
So the resulting folder structure would be like this:
(domain.kz)
www/app
www/cake
www/index.php
(admin.domain.kz)
www/admin/app
www/admin/cake
www/admin/index.php
Then you'll have to point your subdomain (admin.domain.kz) to /www/admin.
Now assuming that you've configured your domain and subdomain correctly, if you try to browse your domain, it'll work with no issues but if you try to access your subdomain, it'll give you a 500 error. DON'T WORRY. It is expected.
The primary .htaccess file is forcing all requests served by primary webroot (www/app/webroot) folder. You'll have to change your primary .htaccess file (www/.htaccess) like this:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^admin\.domain\.kz$ [NC]
RewriteRule ^ - [L]
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
Notice that, I've added two lines which tells that if you're trying to access your subdomain, stop rewriting; otherwise rewrite as usual. Cheers!!!
If the cake apps are totally separate but share a cake library then the following might work:
You could use cPanel's 'Addon Domain' feature, once the DNS has been set up for admin.domain.kz. Instructions can be found here.
Set the document root of the addon domain to the www/app2 folder.
Then just make sure that CAKE_CORE_INCLUDE_PATH in www/app2/webroot/index.php points to ../../../cake

Resources