Forum Moderators: phranque
I don't know regex very well and wondering if someone had a simple script that I could use to test.
Example: mysite.com/check/1.php --> mysite.com/index.php.
I just want to be able to confirm that a simple script will work. The host is not familiar with the mod_rewrite.(PS host is a brother of a friend that I decided to put a couple sites on)
Thanks.
XtendScott
So here's a freebie (See our charter for explanation):
# Set up mod_rewrite
Options +FollowSymLinks
RewriteEngine on
#
# Rules follow
#
# For use in httpd.conf (server configuration):
RewriteRule [b]^/c[/b]heck/1\.php$ /index.php [L]
#
# For use in .htaccess (per directory)
RewriteRule [b]^c[/b]heck/1\.php$ /index.php [L]
I do appriciate the script and it was my intention to make it as simple as possible for someone who knew what they were doing, as I do not mean to have others do my homework for me.
The requested URL /check/1.php was not found on this server.
Apache/2.0.46 (CentOS) Server at www.domain.com Port 80
With this response I should be able to assume that the mod_rewrite is not functioning. I did put this on a server where I know the mod_rewrite is working and it did work properly.
Thanks again, as I now have some verification for the host that it is not working properly.
Xtendscott
The host is saying that the Mod_rewrite is working because they had setup a 301 redirect in httpd.conf for domain.com -> www version of the domain.
Does a 301 in httpd.conf use the mod_rewrite? If so is there a way that the httpd.conf work and not the .htaccess?
Jim
but my problem here is that my index php uses <img src="images/image.gif"...bla bla /> and when i called 'check/1.php' my index.php searches the images in 'www.mysite.com/check/images/image.gif' altough actual image files stand in 'www.mysite.com/images' directory. (this problem can be solved simply by using the actual image paths rather than relative ones but is there any other way?)
This is not the way i will use the mod_rewrite but trying to understand the logic. Thanks