homepage Welcome to WebmasterWorld Guest from 54.205.241.107
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Urgent Help required
its about URL Rewriting
hassanzobeen



 
Msg#: 4222116 posted 9:39 am on Oct 26, 2010 (gmt 0)

Hello Every one I am in a great problem plz help me out

currently my site paths are something like this

domain.com/watch_video.php?v=2238HDRSN3NY

when I use SEO URL it becomes a directory type

I want to rewrite this page some thing like this

domain.com/watch?v=cCoQxfR2gWU

or
domain.com/video?v=cCoQxfR2gWU

I am adding my htaccess line for the url rewriting plz

change this line as I required for my site plzzz help me outttt plzzzzzzz


htaccess line
RewriteRule ^video/(.*)/(.*) watch_video.php?v=$1&%{QUERY_STRING} [L]

 

jdMorgan

WebmasterWorld Senior Member jdmorgan us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4222116 posted 3:53 pm on Oct 26, 2010 (gmt 0)

If you don't use the same "video id number" in the old and new URLs, then your site will quickly become difficult to maintain, and will get slower and slower every time you add a new video URL, because each new video will require an additional rewriterule.

Your example URLs above aren't consistent enough for me to diagnose the problem with your code, but note this important point: Mod_rewrite cannot change the links on your pages. All it can do is to detect requests for certain URLs, and pass those requests to your script with the URL-path information appended as name/value pairs.

The closest I can get is to take you example URLs and filepath above, but assume that the "video id number" does not change:

# Internally rewrite requests for "/video?x=y" to filepath "/watch_video.php?x=y"
RewriteRule ^video$ /watch_video.php [L]

Note that with this code, the "v=2238HDRSN3NY" query string is passed through the rule unchanged. As coded, this query string may contain arbitrary name/value pairs or it may be blank.

Jim

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved