Running a different CMS system under drupal folder - .htaccess

I'm a drupal newbie...
I completed my first drupal site. then client wanted to run their old CRM under new drupal site, they uploaded CRM folder into drupal folder, and when I try to address the CRM admin, as below, it redirects drupal 404 page (which is search page).
www.blablabla.com/crm/admin
Error message from drupal is below:
The page you requested does not exist. For your convenience, a search
was performed using the query 500
shtml.
is there any way that I can make drupal to ignore any folder under its folder? something via .htaccess, or I don't know :/
Appreciate helps so much! thanks a lot!

I would suggest just linking to the old cms from inside drupal.And keep the folders of the old cms outside of the drupal folders. Your old cms also probably doesn't reference the links correctly (its expecting http://oldcmslink and inside of drupal it would be http://drupal?q=something).

Drupal use these lines in the .htaccess file.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
To use a sub-directory below, you will need to either add a RewriteRule before this with the [L] attribute or add your subdirectory to the RewriteCond list here, such as:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/crm/ # Ignore Drupal Redirects for our CRM.
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

You'd have to make a mod_rewrite rule in your .htaccess file. Drupal directs (almost) all its requests to index.php which then sends requests to Drupal's menu router. So your CMS is never going to work unless you create a rewrite rule.
But I would take controlfreak123's advice if you can and move your old CMS site to another address. You're going to have to maintain your own version of Drupal's htaccess file and deal with this work around every time you upgrade. There is also a small chance you might have name collisions later on if you add new modules etc.

Related

Is there a way to properly redirect or rewrite vistors in my drupal 8 website to a subfolder?

I have the following code in my .htaccess file:
RewriteEngine on
RewriteCond %{HTTP_HOST} mysitedomain\.com [NC]
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^(.*)$ /web/$1 [L]
I'm currently using CPanel and CPanel does not allow you to set a new Document Root. So have my drupal files in my CPanel "public_html" directory with the composer.json files etc..and web directory that has all the Drupal related files. I am trying to get the site vistors to rewrite or redirect to www.mysitedomain.com/web for subsequent pages.. I tried the code below but does not seem to work.. Am i missing something?
To be specific.... I need the site to 1. load www.mysitedomain.com/web when www.mysitedomain.com is requested. 2. And ensure /web is is front of every subsequent request page request within the site (ie. www.mysitedomain.com/web/products should load instead of www.mysitedomain.com/products)
I am not sure what your question is, but I think you need something like this:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
What it does: If the URL does not resolve to a file or directory in the present directory, put index.php in front of it.
I'd assume your index.php would then include the Drupal framework.

Decipher .htaccess rewrite rules

I'm trying to upgrade an old PHP script to version 5 - the server is running 5.4.17. Links that worked before are not working anymore and I suspect the server. To determine the servers' guilt in this matter I need to understand a .htaccess file. Can you tell me what this does?
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} ^System/.*
RewriteRule ^(.*)?$ index.php?_path=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)?$ index.php?_path=$1 [L,QSA]
It routes all requests for either something in the System folder or for a file that doesn't exist to the index.php and setting the $_GET['_path'] variable to the request.
To check if this is the problem, try going to a URL like:
http://example.com/index.php?_path=something
where "something" is a page you used to be able to go to but is not working anymore.

In Joomla, I want clean URL

Here is my siteURL http://www.ebiztrait.com/CupidsElite/
I want to create internal pages for this site, with clean URL but as a content I want the same content as it is right now in home page.
So I just want to duplicate home page in siteURL/Success-Stories
Page should have clean URL like this siteURL/Success-Stories
my main condition is I dont want to add anything in .htaccess.
I appreciate if anybody can help me on this.
Thanks
Logically It is not possible without touching .htaccess or server side configuration.
When you write the URL your server is definitely going to look for the index.php file in the folder name.
login in joomla admin
goto global configration
SEF URL set to Yes
then finally save. and check.
Now, you can convert htaccess.txt file to .htaccess
then again check you site to refresh.
For your request is inevitable that you might edit .HTAccess
just add the following entry
<IfModule mod_rewrite.c>
RewriteEngine On
# Removes index.php from ExpressionEngine URLs
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

Make Pretty Url's for Custom CMS with .htaccess

I am making my own CMS for my social networking website. I'm facing a problem, I need to clean the url to make it pretty like facebook does.
URL Rewrite using HTACCESS
Urgly URL => www.domain.com/index.php?options=profile&id=393
Clean URL => www.domain.com/393
Currently am using this code below to remove inde.php?options from url
RewriteCond %{REQUEST_FILENAME} !index.php
RewriteRule .* index.php?options=$0 [QSA,L]
I have searched Google and tired everything but it does not work for me. Something is weird...
please help am stuck really badly..!
I suppose your rule+condition will match every request including images, scripts, stylesheets etc and will redirect it to index.php. I doubt that's what you want.
You can rather do it the other way around. If people visit your index.php or top domain name (eg. www.domain.com) do nothing.
RewriteRule ^index\.php$ - [L]
Then you can rewrite all applicable requests (paths that doesn't exist) to index.php.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /index.php?options=$0 [L,QSA]
Add these rules+conditions to your .htaccess and see if it meets your requirements.

RewriteCond and RewriteRule newbie

I'm taking over a website for a client that is running on a custom built CMS (that I didn't write). I don't mess with .htaccess files usually because a lot of the hosting I do is on IIS, or I used WordPress as a CMS and don't have to worry about messing with the .htaccess file. Here's the contents of the file:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ framework.php?%{QUERY_STRING}&resource=$1& [L]
I get what it's doing (sending all requests through the framework.php file). The client wants a WordPress blog added to their site. I'm placing it in a /blog/ folder. The problem is that because of the rewrite rules and conditions in the .htaccess file whenever I try to go /blog/ the other CMS freaks out because it doesn't like me trying to go there. My question is how do I write a rule/cond that tells apache to send all requests made to the /blog/ folder to the /blog/ folder, but keep all other requests piped through the framework.php file like it is now? Any help is appreciated, thanks!
You should be able to tell the main .htaccess file to ignore any /blog links by adding a RewriteCond to the main rule:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/blog(/?)
RewriteRule ^(.*)$ framework.php?%{QUERY_STRING}&resource=$1& [L]
A /blog link won't be sent to framework.php, and should serve from the /blog directory normally. The Wordpress .htaccess file in that directory will be invoked as it normally would, and should be able to handle Wordpress links from there.

Resources