Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Help with htaccess

Featured Replies

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!

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>

  • 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?

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 by SniderDK

  • 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!

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 :)

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.