January 13, 201115 yr Hi! I have a package of a php website, I know how it should work, it uses modules and tepmlates, I have worked with this kind of stucture before, but not on my own server. Now I have to set up this site on my apache server. I have already set up the virtual hosts, but the index.php is not in the root directory. it is in a folder called webSpace. Do I have to set mysite/webSpace as root directoty? Then my other problem is, that the template system reads data from the url. e.g.: If I type in mystite/news, then news module should load, but now I get a message saying: object not found. Now this has something to do with the htaccess file I assume. My problem is that I do not have any. Can you help me? I have never set up a htaccess file before. Thanks!
January 14, 201115 yr Hi! I have a package of a php website, I know how it should work, it uses modules and tepmlates, I have worked with this kind of stucture before, but not on my own server. Now I have to set up this site on my apache server. I have already set up the virtual hosts, but the index.php is not in the root directory. it is in a folder called webSpace. Do I have to set mysite/webSpace as root directoty? Then my other problem is, that the template system reads data from the url. e.g.: If I type in mystite/news, then news module should load, but now I get a message saying: object not found. Now this has something to do with the htaccess file I assume. My problem is that I do not have any. Can you help me? I have never set up a htaccess file before. Thanks! Hello, it has nothing to do with htacces both your 1st and 2nd problem is related. It seems this is the first time you are using a localhost. are you using wamp, lamp or xammp. Or did you install all of the component of l a m p one by one? Make sure your index.php file is on a folder ou can access. for me, its localhost/joomla. You do not have to change your root directory. As long as you reference a file properly If you installed a local server successfully, check the documentation to know where to place your files for example, i use wamp and the directory for placing my site is in wamp/www. So if i wanted to install a cms like joomla i will place it in the following directory c:/wamp/www/joomla[joomla here being a folder where my joomla site will sit]. After making sure my wamp server is on, and online i point my browser to localhost/joomla or 127.0.0.1/joomla. this automatically loads the index.php file sitting on that directory. You should also check your host file and see if you configured it properly. on my local development server, this is what i placed at the end of my hosts file 127.0.0.1 www.magento.dev magento.dev Then i configured my httpd-vhost.conf file, you should find it at C:\wamp\bin\apache\apache2.2.8\conf\extra\ at the end of the file add this <VirtualHost *:80> ServerAdmin webmaster@project.dev DocumentRoot "C:\Wamp\www\joomla" [replace this area with the absolute path to your site folder] ServerName magento.dev [replace www.magento.dev with the url you specified on your host file] ServerAlias www.magento.dev ErrorLog "logs/project.dev-error.log" CustomLog "logs/project.dev-access.log" common </VirtualHost>
January 14, 201115 yr Author Hello, it has nothing to do with htacces both your 1st and 2nd problem is related. It seems this is the first time you are using a localhost. are you using wamp, lamp or xammp. Or did you install all of the component of l a m p one by one? Make sure your index.php file is on a folder ou can access. for me, its localhost/joomla. You do not have to change your root directory. As long as you reference a file properly If you installed a local server successfully, check the documentation to know where to place your files for example, i use wamp and the directory for placing my site is in wamp/www. So if i wanted to install a cms like joomla i will place it in the following directory c:/wamp/www/joomla[joomla here being a folder where my joomla site will sit]. After making sure my wamp server is on, and online i point my browser to localhost/joomla or 127.0.0.1/joomla. this automatically loads the index.php file sitting on that directory. You should also check your host file and see if you configured it properly. on my local development server, this is what i placed at the end of my hosts file 127.0.0.1 www.magento.dev magento.dev Then i configured my httpd-vhost.conf file, you should find it at C:\wamp\bin\apache\apache2.2.8\conf\extra\ at the end of the file add this <VirtualHost *:80> ServerAdmin webmaster@project.dev DocumentRoot "C:\Wamp\www\joomla" [replace this area with the absolute path to your site folder] ServerName magento.dev [replace www.magento.dev with the url you specified on your host file] ServerAlias www.magento.dev ErrorLog "logs/project.dev-error.log" CustomLog "logs/project.dev-access.log" common </VirtualHost> Thanks for your reply! I have installed xampp as I could not install apache, php and mysql separately, but I am satisfied with it. I got a package from a friend to study this kind of codig. I had to change my root folder in the vhosts file (virtual hosts work fine form me I have other sites as well) And I needed to add a htaccess file. It looks like this: IfModule mod_rewrite.c> RewriteBase / RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?q=$1 [QSA] </IfModule> I have just copied it from another project similar to this one and now it works fine! but, I have no clue what it says. Can anyone point me to a site, blog tutorial, whatever about htaccess files and how to set them up?
January 15, 201115 yr RewriteCond %{REQUEST_FILENAME} !-f = if the requested page is not a file RewriteCond %{REQUEST_FILENAME} !-d = if the requested page is not a directory RewriteRule ^(.*)$ = ^ means the start of the string, $ means the end... the () defines the capture boundary and the .* means capture all characters then pass over to domain.com/index.php?q=^(.*)$ [QSA] = Query String Attatch, meaning if i went to domain.com/somepage.htm?var=1 the rewrite will make domain.com/index.php?q=somepage.htm&var=1 im not so sure on good websites for this as i learn't from a book but hope the above is clear and explains whats going on Edited January 15, 201115 yr by SniderDK
January 22, 201115 yr Author RewriteCond %{REQUEST_FILENAME} !-f = if the requested page is not a file RewriteCond %{REQUEST_FILENAME} !-d = if the requested page is not a directory RewriteRule ^(.*)$ = ^ means the start of the string, $ means the end... the () defines the capture boundary and the .* means capture all characters then pass over to domain.com/index.php?q=^(.*)$ [QSA] = Query String Attatch, meaning if i went to domain.com/somepage.htm?var=1 the rewrite will make domain.com/index.php?q=somepage.htm&var=1 im not so sure on good websites for this as i learn't from a book but hope the above is clear and explains whats going on Thanks a lot! Yes it makes sense now!
January 22, 201115 yr glad it makes sense to you the book i have describes mod_rewrite as "Damn cool voodoo" there's so much you can pull of with it
January 22, 201115 yr I was tidying up my bookmarks the other day and remembered this http://www.noupe.com/php/10-mod_rewrite-rules-you-should-know.html
Create an account or sign in to comment