.htaccess for Different Folder Paths on Server vs. Dev Environment? - .htaccess

I'm moving my app (a CodeIgniter app-- I'm not sure if that is relevant) to a new web host and have to resolve some questions about pathing.
On my localhost dev environment, everything is working. Here is the folder layout:
Root Directory
Application
Here is the folder layout on my web host:
Root Directory
xyz folder
Application
If I visit the following URL in my browser, I get a 404 error:
http://myDomainName/xyz
Is there a way to correct this via .htaccess?
Thanks very much in advance to all for any info.

Try configuring your config.php (application/config/config.php) to point to the correct base url for your webapp.
This line should be included in the file:
$config [‘base_url'] = http://myDomainName/xyz

Related

How to set a subfolder as webapp root on Azure Linux

I'm using Linux on Azure to host my webapp and it deploys fine. My local dev tree structure looks like this:
build
node_modules
src
.deployment
.env
.gitignore
package.json
README.json
...
When I deploy to Azure it looks like this:
dist
node_modules
Within one of my files I re-utilize some components from a node module like so:
import Password from '../../../node_modules/path/to/components/forms/field-types/Password';
There are 2 potential ways to make this work:
Deploy /dist into the root and have node_modules as a sibling but this then makes the relative path above break and ES6 doesn't allow dynamic import strings nor for them to be within blocks
Set the /dist folder as the application root which is actually correct (eg: it contains server.js) and then the relative paths would be correct
I'd prefer #2 however the capability for doing virtual path mapping in Azure doesn't seem to exist so it seems I'd need to leverage .htaccess. I'm curious if there are any other ways to do this and also if the root is set to /dist will the relative path still work or will it be blocked by the server?
Thanks.
.htaccess file setting **RewriteEngine On** on the request path. So if you add an admin-specific .htaccess file in the "subfolder" subfolder, this will preempt the www one and circumvent this problem.
EX:
RedirectMatch ^/my_folder/(.+)/card.jpg$ /script_folder/image.php?perameter=$1
This willredirect /my_folder/xyz/card.jpg to /script_folder/image.php?perameter=xyz changing the address bar from typed url to a new url. If you want the browser to stay on the typed url, you can use the following mod rewrite based solution :
RewriteEngine on
RewriteRule ^my_folder/(.+)/card.jpg$ /script_folder/image.php?perameter=$1 [L]
Please refer this DOC:
Deploy files to App Service - Azure App Service | Microsoft Learn

Configure CodeIgniter to show correct file path for images, etc

I have a CodeIgniter project handed to me by its original developer. I was able to run its home page but the images and links are not working.
My project's path is at http://localhost/my_project.
Upon inspection, all the images' file paths are directed at this fashion: http://localhost/images/image_name.jpg
(Meaning the my_project path is skipped.)
I'm thinking of configuring .htaccess so all resources' location will be directed correctly but I wasn't able to do so.
Any help will be much appreciated.
Use base_url
in config.php
$config['base_url'] = 'http://localhost/my_project';
View file:

LARAVEL 5 - host web server with API

I am trying to set me local project which works perfectly well on a host server (always data).
I made a project folder on the root (/project) of server where I uploaded all my files
I copied public folder into /www
Exactly how explained on this tutorial :https://medium.com/laravel-news/the-simple-guide-to-deploy-laravel-5-application-on-shared-hosting-1a8d0aee923e
First pages load perfectly, but when I am trying to connect with my api, the redirect URL returns a 403 Forbidden error
My redirect url is htp://.......com/public/play
It works when it is localhost but not on my web server...
Should I put www/play as redirect URL?
Why can I access my view on first page but not after redirection from api?
Thank you very much for the help !
You are not may be copying the content of public folder in the www directory Like it said
Next step is to copy all contents inside the /project/public directory
to www/ directory. The easy example is that, with the fresh Laravel 5
installation application, the project/public/index.php should be
copied to the www/index.php , have you got the point?
and you did
I copied public folder into /www

magento bae url not working after dulicate site

I have a site http://www.gingerlily.fr
i copy those file and create sub directory on root called test and uploaded the file to it
duplicated db and apply update for all base url db and other configurations. (http://www.gingerlily.fr/test)
but the problem is when i access http://www.gingerlily.fr/test
site i always show root urls and other js and images loads from root magento installation. i try a day for thi but no luck.
can anyone help me for this something wrong with httacess file or any other wrong with this ?
thank you
I have seen your http://www.gingerlily.fr/. Correct me if i am wrong your trying to duplicate your site to test directory. But in magento your can't copy and duplicate site like PHP /Html here your files of magento site need to be first install and you can replace your module and theme files.

yii, Development and URL issues

We have our server which runs the site at 173......54/
For development we want to have a copy of the code that can be tested at 173.....54/~me/site
When I install a copy of Yii and the code at ~me/ folder and access 173.....54/~me/site I am able
to see the newly installed index html. However, if I try to move to 173.....54/~me/site/book or a user register page or any other page the other (main) Yii application reads the code as a link not found instead of the development Yii application.
Am I supposed to update a the htaccess file to ignore requests within /~me ? If so how should it look? Or am I missing something?
Thanks again!
No need to make ignore in other .htaccess, the dev site .htaccess will take care of it.
In your index.php at the root of your dev site you need to point $yii at your Yii framework/yii.php
and then in the .htaccess in the root of your dev site you need to point RewriteBase to your dev site root.
Also make sure you point to the correct configuration file corresponding with your application in index.php

Resources