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

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

Postby nypd » Tue Nov 13, 2007 4:06 am

I was wonderin how to permanant redirect

/video/%2/ to /video/%2

Just in case the problem above.
nypd
 
Posts: 48
Joined: Wed Aug 01, 2007 2:20 am

Postby richardk » Tue Nov 13, 2007 2:22 pm

Add
Code: Select all
RewriteRule ^(video/[^/]+/)$ /$1 [R=301,L]

before
Code: Select all
RewriteCond %{DOCUMENT_ROOT}/wraps%{REQUEST_URI} !-f
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby nypd » Tue Nov 13, 2007 11:41 pm

The page isn't redirecting properly
nypd
 
Posts: 48
Joined: Wed Aug 01, 2007 2:20 am

Postby richardk » Wed Nov 14, 2007 12:25 pm

Try adding
Code: Select all
RewriteCond %{ENV:REDIRECT_STATUS} ^$

before
Code: Select all
RewriteRule ^(video/[^/]+/)$ /$1 [R=301,L]


If it doesn't work post your .htaccess file.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby nypd » Fri Nov 16, 2007 4:07 am

Nope. did not work. The same error message. Here is the .htaccess:

#### START WORKING SUGGESTION FROM modrewrite.com

# VIDEO WRAP

RewriteRule ^video$ /video/ [R=301,L]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{QUERY_STRING} ^(.*&)?pid=([^&]+)(&.*)?$ [NC]
RewriteRule ^(wraps/)?video/watch\.php$ /video/%2? [R=301,L]

#RewriteCond %{ENV:REDIRECT_STATUS} ^$
#RewriteRule ^(video/[^/]+/)$ /$1 [R=301,L]

RewriteCond %{DOCUMENT_ROOT}/wraps%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}/wraps%{REQUEST_URI} !-d
RewriteRule ^video/([^/]+)/?$ /wraps/video/watch.php?pid=$1 [QSA,L]
RewriteRule ^(video/.*)$ /wraps/$1 [QSA,L]
nypd
 
Posts: 48
Joined: Wed Aug 01, 2007 2:20 am

Postby richardk » Fri Nov 16, 2007 1:31 pm

My mistake, it should be
Code: Select all
^(video/[^/]+)/$

You probably don't need that RewriteCond.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby nypd » Fri Nov 16, 2007 2:17 pm

yes, that works like a charm without the Cond. richardk you are amazing. One last Issue regarding this:

I use the same rewrite for the identical photo galery. however. I have a code which opens the Full size image. The code is:

Code: Select all
<a href="javascript:;" onClick="MM_openBrWindow('displayimage.php?pid=9851&amp;fullsize=1','1960819196473e15e9a2e84','scrollbars=yes,toolbar=yes,status=yes,resizable=yes,width=696,height=511');">
<img src="albums/userpics/10019/normal_1178091335_janosch_simon_37.jpg" width="500" height="364" class="image" border="0" alt="Кликни за пълен размер на снимката" /><br />
</a>


The wewrite code you managed to set for video, works here as well, however, the only problem is when you click on the image, it does not open the large image in a new window, but reloads the page. Now that is normal because the url is:

domain.com/wraps/photo/displayimage.php?pid=9851&amp;fullsize=1

and the rewrite does not fetch the entire url with the JS. Is there solution to this with rewrite.
nypd
 
Posts: 48
Joined: Wed Aug 01, 2007 2:20 am

Postby richardk » Sat Nov 17, 2007 10:13 am

So the problem is the JavaScript file is not loaded? What is the URL of the page? What is the path in the source of the page to the JavaScript file? What is the location on the server of the JavaScript file?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby nypd » Sat Nov 17, 2007 11:24 am

1. The large image folder is the same:
Well it is not a file, just a finction in the HTML whis opens another lindow with the large file. In the example you can see the function and the locaation of the images.

2. The problem is tha twhen i clich the medium image it does not open a ne window with the large image because the URL is"

displayimage.php?pid=9851&amp;fullsize=1

and there is a conflict whit the rewrite, we have finalizad fuew post ago.
nypd
 
Posts: 48
Joined: Wed Aug 01, 2007 2:20 am

Postby richardk » Sat Nov 17, 2007 2:14 pm

If the problem was the path to the large image (displayimage.php?pid=9851&amp;fullsize=1) a window would still open, it would just be an error. The page refreshes, which means the JavaScript isn't running, so i need to know: the URL of the page, the path to the JavaScript file in the source of the page and the location of the JavaScript file on the server.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

PreviousNext

Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 10 guests

cron