I have an root folder like this:
ROOT
|- Service
| |- Admin
|
|- Service 2
I'm interesting in accessing the admin folder from service folder
To access the admin path via url i use mydomain.com/Service/Admin
Is there any way to make it access like this mydomain.com/Admin without moving folders?
I got the answer from one guy and is working, but is not working if i don't add / at the end of Admin
RewriteEngine On
RewriteRule ^(Admin/.*)$ Service/$1 [L,NC]
mydomain.com/Admin/ - working
mydomain.com/Admin - not working (404 error)
I want both to work
I made is like this and is working
RewriteEngine On
RewriteRule ^Admin$ http://mydomain.com/Admin/ [L,NC]
RewriteRule ^(Admin/.*)$ Service/$1 [L,NC]
Related
My query is as following:
On my server, I have multiple codeigniter apps in one folder and 1 subdomain pointing to that folder
Please see the following structure:
eApps (Main Folder)
index.php (used to redirect to Main App) File
Main App (Used for redirecting to other apps) (Sub Folder)
Timekeeping App (Sub Folder)
Activity Delivery App (Sub Folder)
.....so on (15 Apps in total) (Sub Folders)
The main app redirects to other apps by having a common session. This is working perfectly fine on the local server
But on the live server (1and1.co.uk), it has the following problems:
This is due to improper (htaccess) I think:
I don't know what htaccess files to keep in the main folder and what in each folders in order for this to work properly
Sometimes it gives 404 page not found error as well
This is the .htaccess in the main folder:
I also have many app in one folder in my server and for all .htaccess file I use the following code which works fine for me.
Try replacing the following code in your .htaccess:
RewriteEngine on
RewriteCond $1 !^(index\.php|assets|images|js|css|uploads|fevicon.png)
RewriteCond %(REQUEST_FILENAME) !-f
RewriteCond %(REQUEST_FILENAME) !-d
RewriteRule ^(.*)$ ./index.php/$1 [L]
I am trying to make clean url in a website using RewriteRule . But when i call the page from different pages (eg. Header-included in different pages) , it shows 404 - object not found.
I observed that the url treated as different in each page. As per my observation i may need to set a root folder and have to redirect all pages based on that . So that it will redirect to the right destination.
Any information on .htaccess will be helpful
my .htaccess code as follows:
DirectoryIndex index2.php
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)/([a-zA-Z0-9]+)/songs?$ album.php?ad=$2 [QSA,NC]
RewriteRule ^category/([a-zA-Z0-9]+)?$ category.php?ct=$1 [QSA,NC]
RewriteRule ^(.*)/([a-zA-Z0-9]+)/cat?$ /category.php?ct=$2 [QSA,NC]
and my directory:
localhost
|
+mysite
|
+mp3
|
index2.php
category.php
album.php
I am trying to implement a free MVC found on net. My project is stored in http://localhost/project/
The file and folders structure looks like:
/project/
public/ (here I have index.php plus css subfolder, js etc)
controllers/
views/
models/
File index.php (main one) is being kept in public folder.
Now, when I try to access via web: http://localhost/project/employees it works well and it loads employees controller... But when try to access http://localhost/project/employees/methodtest I get File not Found + my CSS files (stored in public/css/main.css) cannot be load and it show path: http://localhost/employees/methodtest/main.css.
I would like to be able to call http://localhost/employees/somemethod/someparams/etc but with my css folders/files still working.
Here is my redirection setup:
RewriteEngine on
RewriteBase /employees/
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
Is above clear enough in order to get some help? - Thanks!
I have my site already built up in say: http://example.com
My Directory structure is:
root/
|
-- htdocs/ ---> This is the document root. All the front end scripts are located here.
| |
| - css/
| - ...
|
-- cms/ --> This is the backend. This site is like a cms Driven Site.
Now I wanted to install laravel in the back end. I want to build my CMS using laravel. But I don't want the URL to be like: http://example.com/cms/public/
I want it just to be: http://example.com/cms/
I know, I can just place all the folders outside in the document root and rename the public folder and change some settings to achieve what I want. But I don't want my document root to have all those files & folders and files mixed with my front end related files & folders. I want this whole thing to be separate and easy to use in other web site back end.
In order to achieve this, I have used 2 .htaccess files.
In the document root, I have:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^cms/$ cms/public/ [L]
RewriteRule ^cms/(.*)$ cms/public/$1 [L]
</IfModule>
And inside the cms folder I have:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
I am not very good at writing .htaccess or doing mod_rewrite.
Can anybody help me
You could achieve what you want in this way:
Create a directory junction for the public folder from laravel to your backend target folder:
mklink /J C:\www\htdocs\app-frontend\cms C:\www\htdocs\app-backend\public
The first path is for the alias and the second path is for the real folder. Here app-backend would be the folder where laravel is installed to.
This is how I deal with Laravel in shared hosting.
If you were to opt for the mod_rewrite approach, the .env file will be exposed.
I have an root folder like this:
ROOT
|- Service
| |- Admin
|
|- Service 2
I'm interesting in accessing the admin folder from service folder
To access the admin path via url i use mydomain.com/Service/Admin
Is there any way to make it access like this mydomain.com/Admin without moving folders?
You can try this rule in your DOCUMENT_ROOT/.htaccess file:
RewriteEngine On
RewriteRule ^(Admin/.*)$ Service/$1 [L,NC]
.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^Admin/ Service/Admin/index.php [L]
</IfModule>
I haven't tested this, but i believe it should work