I would like to use a mod_rewrite to change certain dynamic URLs on my site to static. I have read many of the threads on this topic but none give an example of the rewrite. I have also searched the web and I couldn't get any of the proposed solutions to work. An example of my current URL is: http://www.azmultiplelistingservice.com/listings/listingview.php?listingID=145 I would like it to look something like this: http://www.azmultiplelistingservice.com/listings/listingview-145 Can anyone help?
taken from live site ....nix system RewriteBase / RewriteRule ^who-flies-where-(.*)-(.*).htm$ europe-who-flies-where.htm?ww_from=$1&ww_to=$2 changes /europe-who-flies-where.htm?ww_from=lon&ww_to=spain /who-flies-where-lon-spain.htm but resolves it to the original so no code change... M http://www.departures-arrivals.com/who-flies-where-lon-spain.htm
Here is my latest attempt. RewriteEngine on Options +FollowSymlinks +MultiViews RewriteBase / RewriteRule ^listingview.php?listingID=([A-Z0-9]+) listing-$1
The setting up of the static html URL is not that difficult, but what I have had problems with in the past is then implementing it on to the website, so that the spiders, and visitors to the website only see the html not php Url's on links etc.
I don't mind the php URL's. I'm wanting to make the dynamic URL more spider friendly by removing the [?] and the [ID] from the URL.
Hi ResaleBroker Will have to wait for this one as there is some work to get this to work 100%. Ah found it RewriteEngine on # Redirect internally # listingview/1/ to listingview.php?listingID=1 # I added the rewrite=yes in the query string # this is a trick to avoid an infinite loop RewriteRule ^listingview/([0-9]+)/?$ listingview.php?listingID=$1&rewrite=yes [NC,L] # remove sessions from site php_value session.use_trans_sid 0 AddType application/x-httpd-php .html AddHandler application/x-httpd-php .html Al
Hi here is another code for you: #php.ini configuration <IfModule mod_php4.c> php_value session.use_trans_sid 0 </IfModule> php_flag display_errors Off php_flag register_globals On php_flag track_vars On RewriteEngine On #index Rewriterule ^index.html index.php #listingview RewriteRule ^listingview-([0-9]*).html listingview.php?listingID=$1 RewriteRule ^listingview.html listingview.php RewriteRule ^listingviewprint-([0-9]*).html listingview.php?listingID=$1&printer_friendly=yes #listing_browse RewriteRule ^listing_browse.html listing_browse.php RewriteRule ^rental_browse.html listing_browse.php?type=Rental #userview RewriteRule ^userview.html userview.php RewriteRule ^userview-([0-9]*).html userview.php?user=$1 #contactus RewriteRule ^contactus.html contactus.php #legal RewriteRule ^legal.html legal.php #listingsearch RewriteRule ^listingsearch.html listingsearch.php #rentalsearch RewriteRule ^rentalsearch.html rentalsearch.php #viewusers RewriteRule ^view_users.html view_users.php #viewimage RewriteRule ^viewimage.html viewimage.php RewriteRule ^viewlistingimage-([0-9]*).html viewimage.php?imageID=$1&type=listing Al
This works: RewriteRule ^listingview-([0-9]*).html listingview.php?listingID=$1&rewrite=yes [NC,L] This doesn't work: RewriteRule ^listingview/([0-9]+)/?$ listingview.php?listingID=$1&rewrite=yes [NC,L] Thank You!
I have this already in my htaccess file as: php_value session.use_trans_sid 0. I'm assuming the <IfModule...etc aren't necessary, right? My program is working fine right now. Is this something I should also check? What are these for? They look like something I would find in the php info file but I didn't find them there.
Hi ""I have this already in my htaccess file as: php_value session.use_trans_sid 0."" this code is so the sessions do not show up . ""#php.ini configuration <IfModule mod_php4.c> php_value session.use_trans_sid 0 </IfModule>"" this is for if your php.ini does not have it or your cpanel is not setup. post the link to your site i will check it out for you. Al
Hi Al, I saw this over at the OP forum. Should I be using this too? setcookie("int", 123, time()+86400*365); if ($HTTP_COOKIE_VARS[int] == 123) { session_start(); } else if ($_COOKIE[int] == 123) //you can change this but it depends on which version of PHP you have installed as to which one works. { session_start(); } session_register("session");
Hi Of topic : would you like to add 360 vertual tours to your site ? Let me know, i can set up a demo area for you. Al
Hi Just add this to the .htaccess file # php_value session.use_trans_sid 0 # I think thats what does the trick Al
Hi Jeffrey I have just looked at your site now with the new htaccess file, the listings are great. Will have to do this with all OR's I use Al