I would like to test mod_rewrite functionality on my own Apache server.. so I've read many thread all over the net but... This is my situation...
Running phpinfo()... I can see ...
[...]
apache2handler
Apache Version Apache/2.0.52 (Fedora)
[...]
Loaded Modules core prefork http_core mod_so mod_access mod_auth mod_auth_anon mod_auth_dbm mod_auth_digest util_ldap mod_auth_ldap mod_include mod_log_config mod_env mod_mime_magic mod_cern_meta mod_expires mod_deflate mod_headers mod_usertrack mod_unique_id mod_setenvif mod_mime mod_dav mod_status mod_autoindex mod_asis mod_info mod_dav_fs mod_vhost_alias mod_negotiation mod_dir mod_imap mod_actions mod_speling mod_userdir mod_alias mod_rewrite mod_proxy proxy_ftp proxy_http proxy_connect mod_cache mod_suexec mod_disk_cache mod_file_cache mod_mem_cache mod_cgi mod_auth_mysql mod_perl sapi_apache2 mod_python mod_ssl

So mod_rewrite is enabled...

Then I would like to see if my server allow .htaccess override...
so to check this... I've written a simple command in .htaccess
Redirect /google.html http://www.google.com

But if I browse over it... http://localhost/Rewrite_Tester/google.html
I get a 404 error page...

This is part of my http.conf file...
[...]
LoadModule rewrite_module modules/mod_rewrite.so
[...]
DocumentRoot "/var/www/html"
<LocationMatch "^/$">
Options -Indexes
ErrorDocument 403 /error/noindex.html
</LocationMatch>
<IfModule mod_userdir.c>
UserDir "disable"
</IfModule>
DirectoryIndex
AccessFileName .htaccess
<Files ~ "^\.ht">
Order allow,deny
Deny from all
</Files>
[...]
<VirtualHost *>
ServerSignature email
DirectoryIndex index.php index.html index.htm index.shtml
LogLevel warn
HostNameLookups off
</VirtualHost>
[...]
<Directory "/">
Options FollowSymLinks
AllowOverride All
</Directory>

<Directory "/var/www/html">
Options Indexes Includes FollowSymLinks
AllowOverride All
Allow from all
Order allow,deny
</Directory>

<Directory "/var/www/icons">
Options Indexes MultiViews
AllowOverride All
Allow from all
Order allow,deny
</Directory>

<Directory "/var/www/cgi-bin">
Options ExecCGI
AllowOverride All
Allow from all
Order allow,deny
</Directory>

Recommended Answers

All 3 Replies

Change:
Redirect /google.html http://www.google.com
to:
Redirect /Rewrite_Tester http://www.google.com
or it may need to be:
Redirect /Rewrite_Tester/ http://www.google.com
depending on your apache installation. It looks like Redirect only accepts paths and not file names.

Yesss... solved!!!
Thank you

In fact in my original .htaccess there were a slash...
RewriteRule ^(.*) /index.php [not working]
RewriteRule ^(.*) index.php [working]

You also realize that Redirect is mod_alias yes?

What do you mean ???
I dont' understand your suggestion... :-|

So mod_rewrite is enabled...

Then I would like to see if my server allow .htaccess override...
so to check this... I've written a simple command in .htaccess
Redirect /google.html http://www.google.com

But if I browse over it... http://localhost/Rewrite_Tester/google.html
I get a 404 error page...

Where you used Redirect /google.html http://www.google.com. Redirect is an apache directive. If you go here you will see that it clearly states Module: mod_alias.

I don't see any spot in your origional post where you actually used mod_rewrite. At any rate I am glad you have had some success :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.