scathlock Posted February 7, 2010 Share Posted February 7, 2010 Hello, I have XAMPP 1.6.8. I tried to set up a vhost because I don't want to keep my projects in htdocs. The schema of httpd-vhosts.conf is below: NameVirtualHost 127.0.0.1:80 <VirtualHost 127.0.0.1:80> DocumentRoot C:\xampp\htdocs ServerName localhost ServerAlias localhost www.localhost </VirtualHost> <VirtualHost 127.0.0.1:80> DocumentRoot D:\projects\prj1 ServerName prj1.localhost ServerAlias prj1.localhost www.prj1.localhost DirectoryIndex index.php <Directory D:\projects\prj1> AllowOverride All Allow from All </Directory> </VirtualHost> The problem is that browser can't find images and css because of paths - links are broken. They look like http://prj1.localhost\/forum.php or http://prj1.localhost\/img/pic.gif. When I delete the backslash links are OK. Could You help me with this problem? Quote Link to comment https://forums.phpfreaks.com/topic/191254-vhosts-paths-problem/ Share on other sites More sharing options...
wildteen88 Posted February 7, 2010 Share Posted February 7, 2010 it could be how your links are coded. There is nothing in your vhost config that will cause a \ in your urls. Quote Link to comment https://forums.phpfreaks.com/topic/191254-vhosts-paths-problem/#findComment-1008395 Share on other sites More sharing options...
scathlock Posted February 7, 2010 Author Share Posted February 7, 2010 Links, for example for images, looks like: <img src="img/header.gif" /> Css: <link href="css/style.css" rel="stylesheet" type="text/css" /> Quote Link to comment https://forums.phpfreaks.com/topic/191254-vhosts-paths-problem/#findComment-1008401 Share on other sites More sharing options...
premiso Posted February 7, 2010 Share Posted February 7, 2010 <VirtualHost *:80> DocumentRoot D:\projects\prj1 ServerName prj1.localhost ServerAlias www.prj1.localhost DirectoryIndex index.php <Directory D:\projects\prj1\> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> </VirtualHost> Give that a try and see if it works for you. Quote Link to comment https://forums.phpfreaks.com/topic/191254-vhosts-paths-problem/#findComment-1008408 Share on other sites More sharing options...
scathlock Posted February 7, 2010 Author Share Posted February 7, 2010 Nope, it doesn't. ;( Quote Link to comment https://forums.phpfreaks.com/topic/191254-vhosts-paths-problem/#findComment-1008416 Share on other sites More sharing options...
premiso Posted February 7, 2010 Share Posted February 7, 2010 Well I am not sure. Something in your Apache configuration is messing up, what I do not know. Check the httpd.conf file and make sure all the values there are correct like they should be. Not sure why it would be randomly adding a /. What is the entry you put into your hosts file? Mind posting that? Quote Link to comment https://forums.phpfreaks.com/topic/191254-vhosts-paths-problem/#findComment-1008468 Share on other sites More sharing options...
scathlock Posted February 7, 2010 Author Share Posted February 7, 2010 hosts: 127.0.0.1 prj1.localhost 127.0.0.1 prj2.localhost httpd.conf (without comments) ThreadsPerChild 250 MaxRequestsPerChild 0 ServerRoot "C:/xampp/apache" Listen 80 LoadModule actions_module modules/mod_actions.so LoadModule alias_module modules/mod_alias.so LoadModule asis_module modules/mod_asis.so LoadModule auth_basic_module modules/mod_auth_basic.so LoadModule authn_default_module modules/mod_authn_default.so LoadModule authn_file_module modules/mod_authn_file.so LoadModule authz_default_module modules/mod_authz_default.so LoadModule authz_groupfile_module modules/mod_authz_groupfile.so LoadModule authz_host_module modules/mod_authz_host.so LoadModule authz_user_module modules/mod_authz_user.so LoadModule cgi_module modules/mod_cgi.so LoadModule dav_module modules/mod_dav.so LoadModule dav_fs_module modules/mod_dav_fs.so LoadModule dir_module modules/mod_dir.so LoadModule env_module modules/mod_env.so LoadModule include_module modules/mod_include.so LoadModule info_module modules/mod_info.so LoadModule isapi_module modules/mod_isapi.so LoadModule ldap_module modules/mod_ldap.so LoadModule log_config_module modules/mod_log_config.so LoadModule mime_module modules/mod_mime.so LoadModule negotiation_module modules/mod_negotiation.so LoadModule rewrite_module modules/mod_rewrite.so LoadModule setenvif_module modules/mod_setenvif.so LoadModule status_module modules/mod_status.so LoadModule ssl_module modules/mod_ssl.so LoadModule autoindex_color_module modules/mod_autoindex_color.so ServerAdmin admin@localhost ServerName localhost:80 DocumentRoot "C:/xampp/htdocs" <Directory /> Options FollowSymLinks AllowOverride None Order deny,allow Deny from all </Directory> <Directory "C:/xampp/htdocs"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order allow,deny Allow from all </Directory> <IfModule dir_module> DirectoryIndex index.php index.php4 index.php3 index.cgi index.pl index.html index.htm index.shtml index.phtml </IfModule> <FilesMatch "^\.ht"> Order allow,deny Deny from all </FilesMatch> ErrorLog logs/error.log LogLevel warn <IfModule log_config_module> LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "%h %l %u %t \"%r\" %>s %b" common <IfModule logio_module> LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio </IfModule> CustomLog logs/access.log common </IfModule> <IfModule alias_module> ScriptAlias /cgi-bin/ "C:/xampp/cgi-bin/" </IfModule> <Directory "C:/xampp/cgi-bin"> AllowOverride None Options None Order allow,deny Allow from all </Directory> DefaultType text/plain <IfModule mime_module> TypesConfig conf/mime.types AddType application/x-compress .Z AddType application/x-gzip .gz .tgz AddHandler cgi-script .cgi AddType text/html .shtml AddOutputFilter INCLUDES .shtml </IfModule> EnableMMAP off EnableSendfile off Include conf/extra/httpd-xampp.conf Include conf/extra/httpd-multilang-errordoc.conf Include conf/extra/httpd-autoindex.conf Include conf/extra/httpd-languages.conf Include conf/extra/httpd-userdir.conf Include conf/extra/httpd-info.conf Include conf/extra/httpd-vhosts.conf Include conf/extra/httpd-manual.conf Include conf/extra/httpd-dav.conf Include conf/extra/httpd-default.conf Include conf/extra/httpd-ssl.conf <IfModule ssl_module> SSLRandomSeed startup builtin SSLRandomSeed connect builtin </IfModule> In httpd-vhosts.conf I have two entries - for prj1 and prj2 - both of them look like that I provided in first post. Quote Link to comment https://forums.phpfreaks.com/topic/191254-vhosts-paths-problem/#findComment-1008503 Share on other sites More sharing options...
premiso Posted February 8, 2010 Share Posted February 8, 2010 I doubt this will change anything but perhaps try: <Directory "D:\projects\prj1\"> Inside the vhosts file. Quote Link to comment https://forums.phpfreaks.com/topic/191254-vhosts-paths-problem/#findComment-1008616 Share on other sites More sharing options...
scathlock Posted February 8, 2010 Author Share Posted February 8, 2010 It changes nothing. I work under Windows - maybe this is the problem... Maybe the issue is that Windows adds backlash at the end of the path? Does Apache have some kind of support? I can't find anything like that in website. Quote Link to comment https://forums.phpfreaks.com/topic/191254-vhosts-paths-problem/#findComment-1008712 Share on other sites More sharing options...
scathlock Posted February 8, 2010 Author Share Posted February 8, 2010 One more thing: only one (written in pure php) of two projects has this problem. The second is written in php framework and it works. Can I use mod_rewrite in some way to fix urls and delete backslashes? Can I do anything? Sorry for double-post, I couldn't edit the previous one. Quote Link to comment https://forums.phpfreaks.com/topic/191254-vhosts-paths-problem/#findComment-1008720 Share on other sites More sharing options...
steviewdr Posted February 8, 2010 Share Posted February 8, 2010 Try using a different Internet Browser. Try Opera or Firefox. Quote Link to comment https://forums.phpfreaks.com/topic/191254-vhosts-paths-problem/#findComment-1008837 Share on other sites More sharing options...
scathlock Posted February 8, 2010 Author Share Posted February 8, 2010 Hey, it works! The problem occurs only in Firefox and Opera. IE and Chrome are ok. So... the problem is in Apache or in web browser? Or in Windows? Can I do anything to get things work in Firefox an Opera? Quote Link to comment https://forums.phpfreaks.com/topic/191254-vhosts-paths-problem/#findComment-1008848 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.