URL Rewrite Help for moving Forum

Discuss practical ways rearrange URLs using mod_rewrite.

Postby Caterham » Fri Apr 29, 2005 12:41 am

Change %1 to %2
RewriteRule ^forums/view(topic|forum)\.php$ /forums/index.php?show$1=%2 [R=301,L]
Caterham
 
Posts: 690
Joined: Fri Dec 10, 2004 1:30 pm

Postby Guest » Fri Apr 29, 2005 8:40 pm

Caterham wrote:Change %1 to %2
RewriteRule ^forums/view(topic|forum)\.php$ /forums/index.php?show$1=%2 [R=301,L]

That works beautifully now! Thanks for your time, I greatly appreciate it. Someday hopefully I can help someone else with mod_rewrite questions they may have. :)

Take care!

..Al
Guest
 

Postby dm » Sat May 21, 2005 8:05 am

basicly im trying todo a similar thing.. but i cant for the life of me get it to work properly.. it either gives me a 404 or redirects the entire dir

im basicly wanted to redirect..

forum/viewtopic.php?f=12345

to

oldforum/viewtopic.php?f=12345

ive tried messing about with lots of differnt ways, but if im honest due to lack of sleep and possibly my own idiotic self i cant work it out!

i just tried..


Code: Select all
RewriteEngine On
RewriteCond %{QUERY_STRING} f=([0-9]+)
RewriteRule ^viewtopic.php$ showthread.php?t=$1 [R=301,L]


amoung other things.. and im getting nowhere
dm
 

Postby Caterham » Mon May 23, 2005 12:28 pm

so your folder structure is

/. htaccess (without the space bewteen the . and ht)
/forum/viewtopic.php?f=12345
/oldforum/viewtopic.php?f=12345


in /. htaccess

Code: Select all
RewriteEngine On
RewriteRule ^forum/viewtopic\.php$ /oldforum/viewtopic.php [R=301,L]
Caterham
 
Posts: 690
Joined: Fri Dec 10, 2004 1:30 pm

Postby Guest » Tue May 24, 2005 2:24 am

thanx for the reply.. i added it to my htaccess but soon as i did, i got forbidden messages.. this is my root htaccess

<Ifmodule mod_php4.c>
#php_flag short_open_tag on;
php_flag track_vars on;
php_flag register_globals off;
php_flag allow_url_fopen off;
php_flag magic_quotes_runtime off;
php_flag magic_quotes_gpc off;
php_flag ignore_user_abort on;

php_flag session.use_trans_sid 0;
</Ifmodule>
DirectoryIndex news.php index.php index.html index.htm index.cgi index.phtml

<Files 403.shtml>
order allow,deny
allow from all
</Files>

SetEnvIfNoCase Referer "^http://www.mysite.com/" locally_linked=1
SetEnvIfNoCase Referer "^http://www.mysite.com$" locally_linked=1
SetEnvIfNoCase Referer "^http://mysite.com/" locally_linked=1
SetEnvIfNoCase Referer "^http://mysite.com$" locally_linked=1
SetEnvIfNoCase Referer "^$" locally_linked=1
<FilesMatch "\.(swf|wmv|mpg|mpeg|mpx|avi|mov)$">
Order Allow,Deny
Allow from env=locally_linked
</FilesMatch>


.. soon as i added the rewrite rule, bang could get to the homepage.. im assuming something here is clashing.. (i didnt write the top part it came with part of a script)
Guest
 

Postby Caterham » Tue May 31, 2005 12:32 pm

You'll need FollowSymliks enabled to use mod_rewrite in . htaccess files:

Code: Select all
Options +FollowSymLinks


If you receive a 500 error with this line, you're not allowed to set thid value un . htaccess files. (then, you'll need to add it in your httpd.conf)
Caterham
 
Posts: 690
Joined: Fri Dec 10, 2004 1:30 pm

Postby oliver99 » Mon Nov 02, 2009 2:35 am

I have a similar problem,
redirect:

From:
123456.com/phpBB2/album_cat.php?cat_id=3

To:
123456.com/gallery/album.php?album_id=3

I try this but doesnt work

RewriteEngine On
RewriteRule ^album_cat\.php?cat(.*)$ ./gallery/album.php?album$1 [R=301,L]

(.htaccess in directory /phpBB2 )

Can anyone help please?
Thanks!
oliver99
 
Posts: 3
Joined: Mon Nov 02, 2009 1:33 am

Postby oliver99 » Mon Nov 02, 2009 4:06 am

I found a solution

viewtopic.php?t=6219
oliver99
 
Posts: 3
Joined: Mon Nov 02, 2009 1:33 am

Previous

Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest

cron