Quick mod_rewrtie quesyion

Advert test

Forbairt

Portfolio Building
#22
Ye, its on XP pro, i'll setup a redhat server tomorrow then and try get apache and all working on it! Never setup an *nix webserver box before! should be fun!
Ziycon if you are running apache on xp there should not be a problem make sure mod rewrite is enabled in apache. I test using xampp on my xp machine and have no problem testing mod rewrite.
I'd recommend xampp / wampserver .. (using wamp server cus its what I've used for ages ... if I was to do it again I'd probably move to xampp as there are a few extra nice things bundled with it)
 
#23
Ziycon if you are running apache on xp there should not be a problem make sure mod rewrite is enabled in apache. I test using xampp on my xp machine and have no problem testing mod rewrite.

David my first one (no.2) should work as expected and leave the url as mysite.com/forum/ the same as with any other rule it doesn't add index.php, not sure why you thought it would.

The 3rd does have that obvious disadvantage but without knowing his forum setup it may the easiest way so its good to have it as an option, lateral thinking as you say.

Saying that I think your solution is the best one and would be the recommended one by me too.
Sorry, after looking again at it, you're right. I was thinking [R=301] for some reason. It was late when I was replying! :D
 
#24
I have the .htaccess file in the root folder of the webserver htdocs and i have the load module for mod_rewrite enabled but still wont reslove any of the address i type in!?
 

CiaranR

Weeno Ltd + Skimlinks.com
#25
You should have the .htaccess file in html root folder of the site you are developing not your localhost root (i.e. beside your index.php)

what kind of error are you getting? did you restart apache after enabling the mod rewrite module?
 
#26
You should have the .htaccess file in html root folder of the site you are developing not your localhost root (i.e. beside your index.php)

what kind of error are you getting? did you restart apache after enabling the mod rewrite module?
It just gives me a 404 error! So confused!
 
#29
Another small query!:D

I want it to show the page number and the search type in a linkl, is there a better more efficient way to do this?

releases/1-all.htm
releases/2-some.htm

Where '1' is the $1 var and 'all' is the $2 var in the below rewrite rule:

RewriteRule ^releases/([0-9]+)-([^/]*)\.htm$ /releases.php?page=$1&stype=$2 [L,NC]
 
#31
I don't get it. Is that way not working for you?
It is working but im trying to get it to work with AJAX, i have a page and i want the link to show up say as /releases.htm but to have two variables in the 'real' link to say what page to go to and what sort order like, show only ones starting with a or show all results.

The orginal url is /releases.php?page=1&stype=a but im not sure if i mod_rewrite the url too /releases.php will the ajax script pick up on the different variables and populate the page properly?

Its just im unsure if the mod_rewite has to have the variable in the new url!
 
#33
the ajax call has to go to the server and bring you back the responseText so the RewriteRule will work if properly formated.
If you don't want to add the url to the onclick you can create eventListener for the respective link itself.
 
Top