Change path

Discuss practical ways rearrange URLs using mod_rewrite.

Postby Pablo90 » Sat Dec 06, 2008 9:23 am

richardk wrote:Add
Code: Select all
RewriteRule ^greek$ /greek/ [R=301,L]

after
Code: Select all
RewriteEngine On

No, I would like that it add slashes to all my urls, not just for greek..
To all the urls, I want the final slashes.
Pablo90
 
Posts: 18
Joined: Thu Oct 09, 2008 7:45 am

Postby richardk » Sat Dec 06, 2008 12:43 pm

Code: Select all
AddDefaultCharset iso-8859-1
Options +FollowSymLinks

# Error Pages
ErrorDocument 401 /?act=error&e=401
ErrorDocument 403 /?act=error&e=403
ErrorDocument 404 /?act=error&e=404
ErrorDocument 500 /?act=error&e=500


<IfModule mod_rewrite.c>
  RewriteEngine On

  # Qui redirect per telefilm e notizie
  RewriteRule ^greeek(/(.*))?$ /greek/$2 [R=301,L]

  RewriteCond %{SCRIPT_FILENAME} !-f
  RewriteRule [^/]$ %{REQUEST_URI}/ [R=301,L]

  # BEGIN Gruppo Modulo Rewrite
  RewriteRule ^([-a-z0-9]+)/$ /index.php?act=$1&tid=$1 [NC,QSA,L]
  RewriteRule ^([-a-z0-9]+)/pagina-([0-9]+)/$ /index.php?act=$1&tid=$1&page=$2 [NC,QSA,L]
  RewriteRule ^([-a-z0-9]+)/([-a-z0-9]+)/$ index.php?act=telefilm&tid=$1&mod=$2 [NC,QSA,L]
  RewriteRule ^([-a-z0-9]+)/([-a-z0-9]+)/stagione-([0-9]+)/$ /index.php?act=telefilm&tid=$1&mod=$2&season=$3 [NC,QSA,L]
  RewriteRule ^([-a-z0-9]+)/([-a-z0-9]+)/([-a-z0-9]+)/$ /index.php?act=show&slug=$3 [NC,QSA,L]
  # END Gruppo Modulo Rewrite
</IfModule>

# -FrontPage-
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

<Limit GET POST>
  Order deny,allow
  Deny from all
  Allow from all
</Limit>

<Limit PUT DELETE>
  Order deny,allow
  Deny from all
</Limit>

AuthName telefilmsnetwork.com
AuthUserFile /home/telefilm/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/telefilm/public_html/_vti_pvt/service.grp
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby Pablo90 » Tue Dec 09, 2008 11:23 am

Sorry I don't have tried it yet because I'm a little busy :D

The code about the "rewriting" greeek in greek works, but it's not a redirect 301, right? because google wants the redirect 301 to update the urls...
Pablo90
 
Posts: 18
Joined: Thu Oct 09, 2008 7:45 am

Postby richardk » Tue Dec 09, 2008 12:28 pm

This line should be a 301 redirect (R=301)
Code: Select all
RewriteRule ^greeek(/(.*))?$ /greek/$2 [R=301,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby Pablo90 » Thu Dec 11, 2008 10:58 am

All works fine thank you, just another question :D

Can I add also an "www." before my urls? Like you've done with the slashes :D
thank you :D
Pablo90
 
Posts: 18
Joined: Thu Oct 09, 2008 7:45 am

Postby richardk » Thu Dec 11, 2008 11:33 am

Replace
Code: Select all
  # Qui redirect per telefilm e notizie
  RewriteRule ^greeek(/(.*))?$ /greek/$2 [R=301,L]

  RewriteCond %{SCRIPT_FILENAME} !-f
  RewriteRule [^/]$ %{REQUEST_URI}/ [R=301,L]

with
Code: Select all
  # Qui redirect per telefilm e notizie
  RewriteRule ^greeek(/(.*))?$ http://www.example.com/greek/$2 [R=301,L]

  RewriteCond %{SCRIPT_FILENAME} !-f
  RewriteRule [^/]$ http://www.example.com%{REQUEST_URI}/ [R=301,L]

  RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
  RewriteRule .* http://www.example.com%{REQUEST_URI} [R=301,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby Pablo90 » Fri Dec 12, 2008 2:39 am

Thank you again :D
Bye!
Pablo90
 
Posts: 18
Joined: Thu Oct 09, 2008 7:45 am

Previous

Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: Google [Bot] and 19 guests

cron