Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Magento URL Rewrite problems on localhost
 
meclotel
Jr. Member
 
Total Posts:  6
Joined:  2011-11-14
 

Hello,

I moved my website to localhost to try and make some changes. I followed several steps i found online but i have a problem:

When i type: http://localhost/my_site/ in browser it automatically changes to: http://localhost/my_site/127.0.0.1:3306/ and it gives me error 403 Access forbidden!

If i type: http://127.0.0.1/my_site/ it automatically changes to http://127.0.0.1/my_site/localhost/my_site/ and it gives me 404 not found but it loads a version of the site with no pictures.

I had several problems before that but i managed to resolve them with google. I got stuck here. I might have ruined something else in my attempt to make it work.

I need some help. Please try to explain as detailed as you can.

Thank you!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Siggi_Schmitz
Enthusiast
 
Avatar
Total Posts:  811
Joined:  2011-07-03
 

Hmmm, you have set “http://localhost/my_site/” as base url in your local magento database, right?

 
Magento Community Magento Community
Magento Community
Magento Community
 
meclotel
Jr. Member
 
Total Posts:  6
Joined:  2011-11-14
 

Yes i did that. ...

 
Magento Community Magento Community
Magento Community
Magento Community
 
Siggi_Schmitz
Enthusiast
 
Avatar
Total Posts:  811
Joined:  2011-07-03
 

Maybe it`s your .htaccess? Did you copied it from your server after you have modified it with some changes?
Perhaps try a new .htaccess - file from a clean magento download archive.
And clear all in var/cache/* and var/session/*

EDIT: Und better use http://127.0.0.1/my_site/ as your new base url, instead of localhost

 
Magento Community Magento Community
Magento Community
Magento Community
 
GoMageTeam
Guru
 
Avatar
Total Posts:  356
Joined:  2013-01-13
Warsaw, Poland
 

Hello,

If you want to avoid problems while Magento installation on localhost, we reccomend you to create the separate virtual hosts for it. How to do it in Windows: for example, our webspace is located in the catalog: c:\www

Create the next catalog structure:

c:\www\mysite.web
c:\www\mysite.web\www <- The directory for the storage of the site files.
c:\www\mysite.web\tmp <- PHP temp directory.
c:\www\mysite.web\log <- PHP & Apache log directory.
c:\www\mysite.web\sess <- The directory for the storage of the sessions files.

Then you should copy all Magento files in the folder c:\www\mysite.web\www
You should get the result:

c:\www\mysite.web\www\
app
downloader
errors
...

The further actions is to configure Apache httpd.conf
You should find and uncomment the line:

Include conf/extra/httpd-vhosts.conf
Save the configuration file. Then you should start virtual host configuration.
Open the configuration file virtual hosts Apache (path_to_apache\conf\extra\httpd-vhosts.conf)
Add the next session there ( the default values, which are in this file, can be removed):

#mysite.web
<VirtualHost *:80>
    
DocumentRoot "c:/www/mysite.web/www"

    
ServerName mysite.web
    ServerAlias www
.mysite.web
    ServerAdmin admin
@mysite.web

    ErrorLog 
"c:/www/mysite.web/log/mysite_error.log"
    
CustomLog "c:/www/mysite.web/log/mysite_access.log" common

    
<Directory "c:/www/mysite.web/www">
        
Options FollowSymLinks
        Options 
+Indexes
        AllowOverride All
        Order allow
,deny
        Allow from all
    
</Directory>

    
php_admin_value upload_tmp_dir "c:/www/mysite.web/tmp"
    
php_admin_value error_log "c:/www/mysite.web/log/mysite_php.log"
    
php_admin_value session.save_path "c:/www/mysite.web/sess"
</VirtualHost>

Then you need to add the record in your host file. Open

c:\windows\System32\drivers\etc\hosts

and add the line there:

127.0.0.1 mysite.web www.mysite.web

If you have installed Magento earlier and you have already have the database, you need to change the Base URLs of your site in the database. You can find how to do it here:

http://www.magentocommerce.com/wiki/recover/restore_base_url_settings

Restart the file and reload Apache.
Then open the browser and transfer to the address: http://www.mysite.web/

The virtual host configuration of your site for Linux is the same as for Windows, the only difference is that you need to add the line of your virtual host in
/etc/apache2/sites-available/default

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top