Magento Redirect base url - magento

I have all my folders and files in www.mysite.com/magento/ and my home page base url is www.mysite.com/magento/. I need to change this url to only www.mysite.com and if possible I don't wanna move my files from /magento/ to the back folder.
If I use System - Configuration - Web from my magento-admin-panel, it doesn't work and I can't connect to panel.

You should be able to accomplish that using .htaccess and RewriteBase.
Here's commented out example in Magento .htaccess sample:
############################################
## you can put here your magento root folder
## path relative to web root
RewriteBase /magento/
That should do the trick in your case.
You can read more about RewriteBase here: http://httpd.apache.org/docs/current/mod/mod_rewrite.html#page-header
Edit: In the web root, you'll need some sort of rewrite to Magento root directory:
RewriteEngine on
RewriteCond %{REQUEST_URI} !magento/
RewriteRule (.*) /magento/$1 [L]
Keep in mind that there are all just untested examples that should point you in the right direction. :)
Cheers.

Related

Laravel root directory not public on Hostinger hosting

I currently host my Laravel website on Hostinger, but when I have a image on my page, the url doesn't go to website.com/public/img_url, but it goes to website.com/img_url, does anyone know how this works on Hostinger, and how I can fix this?
Currently my whole project is in my public_html, with no other folders besides it.
The right solution was changing my htaccess to:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
You should need to add a public inside asset function to access a public folder on the shared hosting server.
So you need to change the fetch path of files Example: asset('user/photo.jpg') to asset('public/user/photo.jpg') in each line of code where you need to fetch files from the public directory.

How to setup laravel in this url format http://ip-address/~username

I had setup Laravel projects before but this is my first time setting it up on this url format: http://ip-address/~username.
When I first visited the url, it just shows the directory listing so I tried accessing it by appending /public in the url and it works. However all the other links have /public on it and leads to a 404 error.
This is the current directory structure:
inside public_html
- app
- bootstrap
- config
- database
- public
- other folders
- htaccess
- other files
I tried putting an htaccess file in the project root folder.
<IfModule mod_rewrite.c>
Options -Indexes
RewriteEngine On
RewriteRule ^(.*)$ /public/$1 [L]
</IfModule>
However it still doesn't work and I don't know what to do anymore. If you have been in this kind of situation before, please help me. Thank you in advance.
You'll need to set your WebServer's document root to the public directory, that way it looks in the public and you wont have to append your url with public all the time.
Either that or you'll have to move your index.php out of the public directory and put it inside the root directory your web server is currently set as, but I would recommend you do the first option.

Moving codeigniter project from localhost to cpanel

I am trying to run my codeigniter website on the server.But I don't have a clue that what settings should I perform.
I find the following link to move the files and do the specified settings but still its not showing me the home page of my website.
Here's what I've done till now.
I moved the codeigniter website's application and system folder on the root directory while my .htaccess file along with my assets and index.php is inside public_html.
Here's my directory structure.
-/home/mysite
-public_html
-index.php <-- the path for system is set to '/home/mysite/system' and for application folder is '/home/mysite/application'
-.htaccess
-system
-application
I've performed the following settings as mentioned in the link.
$config['index_page'] = "";
$config['base_url'] = "http://myurl.com/";
$config['server_root'] = $_SERVER['DOCUMENT_ROOT'];
$config['uri_protocol'] = 'AUTO';
$route['default_controller'] = "home_controller";
Here's my .htaccess file.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
Now I don't know why my home page is still not appearing when I enter the url to my site.
upload your application folder, system folder, assets folder, index.php, .HTACCESS inside your public_html folder
You need to do few steps:
update 'application/config/config.php' for base_url
update 'htaccess' file for RewriteBase (if needed)
update file permission (if needed)
update 'aplication/config/database.php' for database settings
if still you face issue, then you need to debug like:
print something in index controller and walk through along the function sequence called and then views.

issue with shifting Kohana 2.4 from root location to make it accessible via a directory?

I have developed a kohana project 2.4 version, with i has been developed by configuring virtual host and we are accessing it using some domain aa.com, now i have to move the project to folder named kohana and make it access via aa.com/kohana. If i access it this way then my url changes, So the css & js file are not included since the src url i have provided like /public/css/ so it's not working, same goes for calling a controller. like il be calling a controller using this format /user/login/. now the url when i click to shows like aa.com/user/login which is not found, in turn it should automatically comes like aa.com/kohana/user/login. Is there any way by changing the htaccess file or hacking routes.php file. ?
I should able to automatically append /kohana/ before the url.
Please suggest me a method how it can be achieved.
Yes there is!
I've only started after kohana 3.0 but you can just change the rewritebase.
In your .htacces it probably says "rewritebase /"
Change this to your new directory. "rewritebase /kohana/"
If 2.4 has a bootstrap (i'm not sure) somewhere it should say "base_url". You change this the same as the .htaccess. /kohana/.
edit: here's an example:
# Turn on URL rewriting
RewriteEngine On
# Installation directory
RewriteBase /kohana/
# Protect application and system files from being viewed
RewriteRule ^(application|modules|system) - [F,L]
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT,L]

Magento URL issues

I am still new to magento but I have been slowly making progress on replicating the production environment to a sandbox environment.
The issue I am currently running into is that when I go to my site I get a long url rather than a short optimized url. I am guessing it is a configuration setting that I need to change as well as, I went through and had to add index.php to the url string for it to work properly.
What I want to be able to do is use a short url such as /category/page.html rather than catalog/category/view/s/power-tools/id/261/
Thank you in advance!
This is probably because you need to reindex Catalog URL Rewrites. Go to System->Index Management and reindex. (It's probably best to select all and reindex though just to be sure!)
After working through this, I ended up changing the .htaccess Mage::run() settings. I ended up having to change some of the base url setting in the core_data_config table to finish getting everything to work correctly. I also ended up having to set the SEO rewrites (System Config > General > Web > Search Engine Optimization > Use Web Server Rewrites) = No
I found that once index.php was included in the path then my site was working properly.
This is what i ended up doing and it removed the index file as well. Part of the issue is that I installed magento in /store/dir/
1) Login to admin section by using the URL
http://domain.com/index.php/admin
2) then go to “System >> Configuration >>Web >> Search Engines Optimization”
Use Web Server Rewrites : YES
3) Go to “System >> Configuration >>Web >>Secure”
Use secure URL Frontend: YES
** I used the second one **
4)Then create the .htaccess file under your the magento installed folder.
If the magento installed under document root ( /home/username/public_html) then add follogig rules into .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
and If the magento installed under /shop or directory then add the following rules into ” /home/username/public_html/shop/.htaccess ” file.
<IfModule mod_rewrite.c >
RewriteEngine On
RewriteBase /shop/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /shop/index.php [L]
</IfModule >
http://www.bestdesigns.co.in/blog/remove-index-php-url-magento

Resources