Forum Moderators: phranque
www.domain.com/SmallBoatRentals/tabid/477/Default.aspx
www.domain.com/FAQs/tabid/482/Default.aspx
www.domain.com/HouseboatVacation/tabid/476/Default.aspx
I've tested the following, but the regex is not catching the visit so not doing anything.
RewriteEngine on
RewriteRule (.*)/tabid/(\d+)/.*\.aspx$ [domain.com...] [I]
I'm trying to produce form this:
www.domain.com/SmallBoatRentals/tabid/477/Default.aspx
This:
[domain.com...]
OR
[domain.com...]
ANY help would be appreciated.
The .net nuke system builds urls like this and they do physically exist:
www.domain.com/SmallBoatRentals/tabid/477/Default.aspx
I thought that this rewrite rule
RewriteRule ([a-z0-9]+)/tabid/([0-9]+)/.*$ [domain.com...] [NC,L]
would deliver the ugly page url above to a visitor (or search engine) but show and be known as this url
www.waterwayadventures.com/SmallBoatRentals-477/Default.aspx
What am I not understanding here?
> What am I not understanding here?
Mod_rewrite (or ISAPI Rewrite) takes the "shown and known" URL and rewrites it to the file that actually exists. Therefore, it's likely you're not understanding when a rewrite occurs, and what it does.
If you want "pretty" URLS, but your script requires "ugly" ones, then mod_rewrite can "input" a "pretty" URL that a user has seen and clicked on (or that a search engine has found on a page and has requested), and convert it into the actual "ugly" call ro your script. URL-rewriting occurs after a request arrives at your server, but before any pages are served or any scripts are invoked.
On the Web, the URL that appears on your page is "what actually exists." Inside the server, the path to the html page (or the path to the script and the required calling parameters) are what actually exists. Mod_rewrite converts between the URL-world and the filepath/script-path world.
Bottom line is that whatever URL you want the visitor to see and the search engines to index needs to be coded onto your page. Once a request for that URL is received by your server, you can convert it into any filepath or script call that you like.
And to explain this from the other side, mod_rewrite does not change the content of your pages in any way; It works only on the incoming HTTP requests, and does not function as any kind of content output filter.
This post [webmasterworld.com] in our forum library discusses the process for Apache mod_rewrite, and ISAPI Rewrite will be similar.
Jim
[edited by: jdMorgan at 1:39 am (utc) on Sep. 14, 2006]
Sounds like the best course of action is to modify the .net nuke scripts and database to produce as friendly of URLs as possible before trying to fix everything with mod_rewrite!
Does that make sense?
If you have only one script, an alternative method is to rewrite all page requests to it, and then 'convert' the URL-path info into script paremeters inside the script. In other words, it's your choice whether to convert URL-path info to script variables by using mod_rewrite or by doing it inside the script itself; The complexity can be in one or the other, it just depends on which is easier for you to code.
Jim