video/watch.php?pid=320 --> watch:320

New to mod_rewrite? This is a good place to start.

Postby nypd » Sat Nov 17, 2007 3:00 pm

But the Java scripts works perfect without using the photo rewrite. However, here is what you requested:

/var/www/domain.com/www/root/wraps/photo/scripts.js
domain.com/wraps/photo/scripts.js (you can view the source here)

a example page is:
http://mqsto.com/photo/displayimage.php?pid=92

after it is rewrited it is:
http://mqsto.com/photo/92
nypd
 
Posts: 48
Joined: Wed Aug 01, 2007 2:20 am

Postby nypd » Sun Nov 18, 2007 8:30 am

I am sory, i gave you false info. The page does not reload, it opens in a new window, but not wit the Large image but shows the same page (url):
http://domain.com/photo/15100

so the scripts is loaded. thats for sure
nypd
 
Posts: 48
Joined: Wed Aug 01, 2007 2:20 am

Postby richardk » Sun Nov 18, 2007 11:54 am

All the /photo links result in a 404 error so i can't test.

Try replacing
Code: Select all
'displayimage.php?pid=9851&fullsize=1'

with
Code: Select all
'/photo/displayimage.php?pid=9851&fullsize=1'
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby nypd » Sun Nov 18, 2007 1:13 pm

Nope. not working again. Even the full (url 'http://domain.com/wraps/photo/displayimage.php?pid=9851&fullsize=1') is opening a new page with the same page (http:/domain.com/photo/9851)


Here is the entire Photo code


Code: Select all
# PHOTO WRAP

RewriteRule ^photo$ /photo/ [R=301,L]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{QUERY_STRING} ^(.*&)?pid=([^&]+)(&.*)?$ [NC]
RewriteRule ^(wraps/)?photo/displayimage\.php$ /photo/%2? [R=301,L]
RewriteCond %{DOCUMENT_ROOT}/wraps%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}/wraps%{REQUEST_URI} !-d
RewriteRule ^photo/([^/]+)/?$ /wraps/photo/displayimage.php?pid=$1 [QSA,L]
RewriteRule ^(photo/.*)$ /wraps/$1 [QSA,L]
nypd
 
Posts: 48
Joined: Wed Aug 01, 2007 2:20 am

Postby richardk » Sun Nov 18, 2007 1:33 pm

Try '/photo/9851?fullsize=1'.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby nypd » Sun Nov 18, 2007 3:47 pm

Well, i can not beleive how can i be so stupit not to think of that myself. Thaks again richardk. You are modrewrite GURU !!!
nypd
 
Posts: 48
Joined: Wed Aug 01, 2007 2:20 am

Re: video/watch.php?pid=320 --> watch:320

Postby nypd » Thu Apr 29, 2010 4:20 am

Well jus tto refresh this. Now, thanks to Richardk I have working code like this:

Code: Select all
RewriteRule ^photo$ /photo/ [R=301,L]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{QUERY_STRING} ^(.*&)?pid=([^&]+)(&.*)?$ [NC]
RewriteRule ^(wraps/)?photo/displayimage\.php$ /photo/%2? [R=301,L]
RewriteCond %{DOCUMENT_ROOT}/wraps%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}/wraps%{REQUEST_URI} !-d
RewriteRule ^photo/([^/]+)/?$ /wraps/photo/displayimage.php?pid=$1 [QSA,L]
RewriteRule ^(photo/.*)$ /wraps/$1 [QSA,L]


to get short URL's
However, now, instead /video/1293 I want to make it /video/1293/tile of the page
nypd
 
Posts: 48
Joined: Wed Aug 01, 2007 2:20 am

Re: video/watch.php?pid=320 --> watch:320

Postby nypd » Fri Apr 30, 2010 5:59 am

Id did replace
this:
Code: Select all
RewriteRule ^photo/([^/]+)/?$ /wraps/photo/displayimage.php?pid=$1 [QSA,L]

with:
Code: Select all
RewriteRule ^photo/([^/]+)/([^/]+)/?$ /wraps/photo/displayimage.php?pid=$1&title=$2 [QSA,L]


and it did the job. However, now, instead the root URL to be photo, it is photo/123

what am I missing...

P.S. Also I need to add a re-write to all photo/ID to photo/ID/title any sugestions would be greeeeaaatly appreciated :)
nypd
 
Posts: 48
Joined: Wed Aug 01, 2007 2:20 am

Previous

Return to Beginner's Corner

Who is online

Users browsing this forum: Majestic-12 [Bot] and 3 guests

cron