I've cloned my website to xampp for a local version. My WordPress site is located in C:/xampp/htdocs/my-website.
I've also cloned my database to local and changed the urls from the web to http://localhost/my-website.
I've made a .htaccess file and already set xampp overwrite all in httpd.conf that the file won't be ignore.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /my-website/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /my-website/index.php [L]
</IfModule>
# END WordPress
I can see my website with http://localhost/my-website but all my .js, .css, .png etc. files can't be found. I looked in network analystic from Firefox and the links are not complete.
This is the wrong link:
http://localhost/wp-content/themes/storefront/startseite.js
But it should look like this:
http://localhost/my-website/wp-content/themes/storefront/startseite.js
I've searched a lot in google but can't find a solution. Hope you know a answer.
Thanks guys!
</div>
changed the urls from the web to http://localhost/my-website....
How did you do that? In wp_options? Or Appearance>>General Settings?
You should use interconnectit.com WordPress Serialized PHP Search Replace Tool to change all URLs in the database options and in post/page content. That tool will correctly change all URLs and it also correctly deals with serialized data in the database.
And, after you make a directory or folder move of a WordPress site, resave permalinks in Settings>permalinks. That will write the correct permalinks to .htaccess.
Also see Moving WordPress « WordPress Codex
I found a solution. I have to make a virtual host for my site. Here are the 4 steps you have to do:
#localhost
<VirtualHost *:80>
DocumentRoot "C:/XAMPP/htdocs"
ServerName localhost
</VirtualHost>
#My Website
<VirtualHost *:80>
DocumentRoot "C:/XAMPP/htdocs/my-website" #your path to your installation
ServerName my-website.dev #Change my-website to your wish name/url
ServerAlias my-website.dev #Change my-website to your wish name/url
</VirtualHost>
127.0.0.1 my-website.dev
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
You have to save all files and restart your Apache and MySQL Server
http://my.website.dev
. To make this step easy you've to download the Database Search and Replace Script in PHP from https://interconnectit.com/products/search-and-replace-for-wordpress-databases/
. Unzip this and paste the folder Search-Replace-DB-master
in C:/XAMPP/htdocs
. Open your browser and go to this url: http://localhost/Search-Replace-DB-master/
. Now enter your database informations in the database section (db-name, user, passwort). Go to the top and enter in the replace
field your old url (in my situation: https://my-website-old-url.com
) and in the field after with
your new url (in this situation: http://my-website.dev
).Now click on live run in the middle of the page and all of your old urls will replaced with the new one.
Finaly go to the browser and enter your new url: my-website.dev
Thats it! Hope I can help someone with this.
</div>