I'm trying to configure a friendly URL system for my website and due to i'm new in these tools, I was testing at the first time on my client localhost.
The fact is I want to convert this URL:
http://laventanaindiscretadiego.url.ph/page/index.inc.php?lang=en_EN
into this other one
http://laventanaindiscretadiego.com/main
For that i'm using a .htaccess file and i'm using RewriteRule as i show here
RewriteRule ^/laventana/page/main$ /laventana/page/index.inc.php?lang=$1
after I apply changes on my .htaccess and i save everything, nothing happens and the url is not rewrited.
As an extra information, httpd.conf was already eddited removing the coment for the next lane:
LoadModule rewrite_module modules/mod_rewrite.so
I also checked that AllowOverride was in the option All as you can see:
<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
</Directory>
I also checked that the document root was the correct, in my case:
DocumentRoot "C:/xampp/htdocs"
The last thing i could say about, it's that the .htaccess document is in the root folder (htdocs) so it makes sense and i've tested it before with a simple redirection like in this example
Redirect /laventana/page/index.inc.php?lang=$1 http://www.disney.com
The redirect is stupid but i wanted to test the .htaccess was working.
Have anybody any clue of what is happening me and/or if I have any mistake?
Thank you!
Related
I have a working Magento shop online. I'm trying to make it run locally as a copy for testing purposes. Everything works, except the url rewriting. I've already added the AllowOverride All option to my httpd config file, as everyone here suggested.
<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
</Directory>
I also have RewriteEngine on in my .htaccess file (same htaccess as the online website). Still I'm getting the index.php 404 error on every other page than the homepage. http://www.example.com/index.php/randompage however does work. What's also strange is that the same configuration works for developer, but not for me. So it must be something apache specific I guess.
I've tried a lot of given suggestions in similar topics but nothing worked :(
Running macosx 10.9.5
I'm out of ideas. Thanks in advance!
You must have mod_rewrite enabled for apache.
Run a2enmod rewrite and then /etc/init.d/apache2 restart
You can try setting the RewriteBase parameter which may fix the issue.
In the .htaccess file in your Magento root on your local machine, look for the following:
#RewriteBase /magento/
Change it to
RewriteBase /
I can't get .htaccess to work in xampp under Ubuntu 13.04 and the server keep showing the 404 error page I tried to modify httpd.conf in /opt/lampp/apache2/conf/ with this code
<Directory "/opt/lampp/apache2/htdocs">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
LoadModule rewrite_module modules/mod_rewrite.so
but still give the same error page
it looks like the server can't see the .htaccess file.
What to do .. ?
Make sure your htaccess file is in the right place (/opt/lampp/apache2/htdocs) and that it is readable (chmod 644 /opt/lampp/apache2/htdocs/.htaccess) and that the access file is set to ".htaccess":
AccessFileName .htaccess
By default, it's already ".htaccess" but it could have been changed.
Finally, try adding some gibberish to the top of your htaccess file (like "ashdakjhfdksjfhds"), if you get a 500 internal server error, that means your htaccess file is being read and the problem isn't your setup but the contents of the file.
How do I disable single option override in specific folder in Apache? I'd like to force DirectoryIndex value in specific folder, so DirectoryIndex option in .htaccess of that folder will be ignored. I'd expect configuration should look somehow similar, but neither works:
<Directory "/home/me/www/symfonyProject1">
DirectoryIndex app_dev.php
AllowOverride -Indexes
</Directory>
or this
<Directory "/home/me/www/symfonyProject1">
DirectoryIndex app_dev.php
AllowOverride Options=-DirectoryIndex
</Directory>
Is this even possible? How could I achieve that?
Using: Apache/2.2.8 (Win32) & Windows 7 x64
The only possiblility, even though it is definitely not kosher, is to let .htaccess be ignored by versioning system locally. Then you can change as you wish to adapt you instance.
In case you need to change original .htaccess, you must do following (for GIT):
backup your modified .htaccess file
Comment out line .htaccess in file .git/info/exclude
do git checkout -- .htaccess to retrieve original file
modifiy and commit changes
Uncomment .htaccess line in .git/info/exclude
Copy modified .htaccess from backup to working tree
I did not get this working with the <Directory> tag in httpd.conf but it was working if I did the following:
In /home/me/www/symfonyProject1 create a .htaccess file and put DirectoryIndex app_dev.php in it.
This should work as long as you AllowOverride All (Or more narrow if needed) in the parent configuration.
I have a Debian web-server with Apache2 installed and need to set in one directory DirectoryIndex to .html file (exactly this name - .html). But when I try to open page from browser it send 403 error.
I've changed apache2.conf (set to allow .ht files), I placed .htacess file in directory and set in it:
DirectoryIndex .html index.php index.html
AllowOverride All
Order Deny,Allow
Allow from all
But it still not work and displays 403 error. What i doing wrong and what i forget to do?
The correct answer is:
<FilesMatch "^\.html">
Order deny,allow
</FilesMatch>
DirectoryIndex .html
Sounds like you have a rule somewhere in your apache file that denys access to files starting with a .. This is generally a Good Thing, as a lot of sensitive files start with dots (ie: .htaccess, .svn, .git, .htpasswd, etc etc).
You might be able to get around the issue with something like this:
<FilesMatch "^\.html">
Order allow,deny
Allow from all
</Files>
Disclaimer: This seems like a hack. I don't know what you're trying to do, but there's probably a cleaner, less error prone way to do it.
I'm wondering how to forbid access to the all directories except one using .htaccess file.
The construction like
<Directory />
Order Deny,Allow
Deny from all
</Directory>
<Directory /folder>
Order Deny,Allow
Allow from all
</Directory>
raises Error 500. It can be put only in apache conf file, right? Or I'm doing something wrong?
The Directory directive may not be used in a .htaccess file (see the Context section of the Directory docs). From within a .htaccess file you can use Files or FilesMatch as a section container, or mod_rewrite. Assuming you're allowed to use mod_rewrite (and you have a good reason for using a .htaccess file in the first place, like say, you're not the server admin):
RewriteEngine On
RewriteRule !folder [F]
In principal this answers your question. It's more likely though that your situation is more complicated than you're letting on.
http://httpd.apache.org/docs/2.2/mod/core.html#directory
http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule
http://httpd.apache.org/docs/2.2/sections.html
BTW, this question probably belongs on serverfault.com