|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
mod rewrite help
Ok I admin, mod rewrite is very frustrating
. So im giving in on trying, and seeking some help.First are my questions. 1) If you wanted to turn mp3.php?q=Query&In=Insomething would you need to rename mp3.php to mp3, and use a force mimetype? 2) If you did the above could you just type domain.com/mp3/Query/Insomething, and it will work vice versa also? Heres what ive tried so far. Code:
<Files mp3>
ForceType application/x-httpd-php
</Files>
RewriteEngine On
# A request for this.php?that=someargument
# will be redirected externally to this/someargument
RewriteCond %{QUERY_STRING} ^s=(.+)$
RewriteRule ^mp3\.php /mp3/%1? [R,L]
# A request for this/someargument will be redirected internally
# to this.php?rewrite=yes&that=someargument
# I had to add on the query string the parameter rewrite to avoid
# to create an infinite loop, but because the redirection is
# done internally the client (the browser) won't see it
RewriteRule ^mp3/([^/]+)/?$ /mp3.php?q=([^/]+)&in=([^/]+) [L]
But it doesn't fully work Thanks. |
|
#2
|
|||
|
|||
|
I'm not clear exactly what you are trying to do, but if you are trying to mod rewrite:
domain.com/mp3.php?q=Query&In=Insomething to: domain.com/mp3/Query/Insomething In your .htaccess file try: RewriteEngine on RewriteBase / RewriteRule mp3/([^.]+)/([^.]+)/ mp3.php?q=$1&In=$2 DirectoryIndex index.html index.php errorDocument 404 /index.php In your main page add: <base href="http://www.domain.com"> eg: <html> <head> <title>Page title</title> <base href="http://www.domain.com"> </head> ...rest of code Quote:
|
![]() |
| Viewing: Dev Shed Forums > Web Design > Search Engine Optimization > mod rewrite help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|