I am a newbie to Magento and Apache conf. I'm using Magento 1.8.0. I have configured the path so as to remove index.php from the URLs for my pages eg
from
/magento/index.php/electronics/cell-phones.html
to
/magento/electronics/cell-phones.html
However my browser requests now direct to the index.php of my server root. I have tried adding a config section for magento as shown, but no change. What am I doing wrong?
<Directory "C:/hiddenpath/apache2/htdocs/magento">
Options All
AllowOverride All
Order allow,deny
Allow from all
Deny from none
</Directory>
In your .htaccess file find Rewrite Base/ and replace it with Rewrite Base/magento if it is commented using # un comment it.
Related
Stuck into a strange situation while upgrading the website to Codeigniter.
http://website.com/download - View .php page
http://website.com/download/files - Directory
If I allow directory within the .httaccess file, view stops working. Similarly, when I disallow directory, view works but directory URL throws error.
Please help
U can configure in virtual host setting.
Allow directory listing.
<Directory /usr/local/apache2/htdocs/listme>
Options +Indexes
</Directory>
Disable directory listing.
<Directory /usr/local/apache2/htdocs/dontlistme>
Options -Indexes
</Directory>
I have a website built in PHP. Currently my URLs look like:
http://www.domain.com/web/views/site/event.php?id=1&name=Test
I want them to be like:
http://www.domain.com/event/id/1/name/Test
How can I achieve this? I have tried multiple tutorials and have checked for answers in stackoverflow but have not been able to find a proper solution.
Any thoughts?
Thanks in advance.
Create an .htaccess file and add the following lines:
RewriteEngine On # Turn on the rewriting engine
RewriteBase /
RewriteRule ^event/id/([A-Za-z0-9-_]+)/name/([A-Za-z0-9-_]+)/?$ web/views/site/event.php?id=$1&name=$2 [NC,L]
Two things that you should keep in mind:
.htaccess should be located at your root directory
Make sure that apache has the following directive regarding your root directory:
AllowOverride All
This is how is done:
If you have root access to your server, edit the httpd.conf file, find the root <Directory> line, and change it to this:
<Directory />
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
If you don't have root access, ask your server administrator to do that for you.
in my apache sites-available/default file i had change the config to folowing:
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All //originally was AllowOverride None
FallbackResource rewrite.php //i added this line, too
Order allow,deny
allow from all
</Directory>
i wanted to handle all url calls in my own rewrite.php file. this works, when i visit my site at http://192.168.1.104:4567/web/knxzkcha but doesnt work when i go for http://192.168.1.104:4567/web/. i got this problem in firefox : The connection to the server was reset while the page was loading.
the index site http://192.168.1.104:4567/web/index.php works flawlessly and shows me my index.php file. all i want is to let me show the index file when visiting the root directory, too. /var/www points to the /web directory. i have some ubuntu 12.04 server 64 LTS edition
when i rewert the config lines, the root gives me the index file by default.
You do not need to add AllowOverride All, telling apache to avoid IO by checking existence of .htaccess files in current directory and all parents directories with AllowOverride None is a good recipe for speed. Avoid .htaccess files if you can edit Apache configuration.
Now FallbackResource is a quite new feature and may have some bugs. Did you check the ErrorLog for details? Could you try that with LogLevel debug?
It seems you problems is with directories, maybe you could fix it by enforcing usage of your fallback when a Directory is requested, try to add:
DirectoryIndex rewrite.php
My site is a Wordpress-site created with PHP.
I have made changes in permalink default to postname. It works fine in Chrome and Firefox but not in IE8. The front page displays correctly but when I click a link to another page, it shows a 404 page not found error.
I'm using Wordpress version 3+.
.htaccess file is
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>
# END WordPress
where WordPress is folder name.
also in apache rewrite_module is enable
First put a .htaccess file in your /var/www/ folder and make it writable.
Second, suppose your wordpress blog is in /var/www/blog folder then go to /etc/apache2/sites-available/
and make following changes in default file
<Directory /var/www/>
Options +ExecCGI
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
<Directory /var/www/blog/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
Now restart apache to make sure changes have taken effect. Hope it helps.
After trying all of these answers and the instructions on codex.wordpress.org, I needed to enable mod_rewrite on Apache:
https://stackoverflow.com/a/5758551/728287
Just go into wordpress /wp-admin, which will still work, and navigate to settings->permalinks. When you go to that page, wordpress will rebuild your .htaccess file and everything will work again.
EDIT (FROM http://codex.wordpress.org/Using_Permalinks)
If the above does not work:
Paged Navigation Doesn't Work
Sometimes navigation to second (and subsequent) pages of posts does not work as expected.
The result of clicking one of those links is that the page loads with all the surroundings (header, footer, sidebar), but instead of a page of posts, there is an error message: "Sorry, no posts match that criteria."
This is due to a glitch in the .htaccess file that WordPress generates.
To fix it, delete the contents of your .htaccess file and re-create it.
In the Control Panel, go to Manage > Files (More Info on Editing Files)
Click the link to your .htaccess file to edit its contents
Copy the contents of the file and paste it to a text file in a text editor. This is a precaution in case your .htaccess file has manual entries for redirects, denials or other handy htaccess tricks
Delete all contents from your .htaccess file and click the Update File button.
In the Control Panel, go to Options > Permalinks.
Click the Update Permalink Structure button to freshly generate new rewrite rules for your permalinks.
Test the results using a link that had previously broken.
Add any manual htaccess entries back in your file (Place manual htaccess entries before the # BEGIN WordPress or after # END WordPress lines.)
You may also perform similar steps by deleting the .htaccess files from the server, creating a fresh empty .htaccess file, changing its permissions to 666, and then in Options -> Permalinks generate a new set of htaccess rules by clicking the Update Permalinks Structure button.
If that still doesn't work, take a look at the WordPress support forums, specifically http://wordpress.org/support/topic/permalink-nextpage-doesnt-work#post-283222
I had the same issue locally, I tried everything above. After a while I realised how the vhost is setup for the application the .htaccess is not enabled.
<Directory "/Applications/XAMPP/htdocs/wordpress">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Adding these lines, helped me a lot and resolved my issue.
Enable rewrite_module in Apache-> Apache Moduels
RewriteEngine on
RewriteRule ^(.*)\.txt$ $1.php
This is the rewrite rule I am using to a specific directory of my website
http:// xxx.yyy.zz.aa /~nishant/directory/.htaccess
to change all .php extension to .txt
when I look the directory file :
http: // www.mysite.com / directory/order.txt (it is working) but
http:// xxx.yyy.zz.aa / ~nishant/ directory/order.txt (is not working)
What do you suppose the problem is, and what is the proper solution?
This might be caused by your 'VirtualHost' - configuration: /etc/apache2/sites-available/...
In detail, look for 'AllowOverride ...' in a file containing 'VirtualHost xxx.yyy.zz.aa:80' or 'VirtualHost *:80'
There might be following statement missing:
<Directory /home/*>
AllowOverride FileInfo Options
</Directory>
or:
<Directory /home/nishant>
AllowOverride FileInfo Options
</Directory>
You need at least 'FileInfo' for mod_rewrite to work.
'Options' isn’t required for mod_rewrite but is commonly required if you are using .htaccess.
http://httpd.apache.org/docs/2.2/en/mod/core.html#allowoverride