Forum Moderators: phranque
[widgetc0.c0m...]
[widgetc0.c0m...]
[widgetc0.c0m...]
and I would like it to be change/rewritten to :
[widgetc0.c0m...]
[widgetc0.c0m...]
[widgetc0.c0m...]
I read the procedure on how to change a static url to dynamic url and created this .htaccess file with the following codes but I can't get it to work properly:
---------------000----
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^k/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$ /topsites.php?k=$1&r=$2 [L]
RewriteRule ^s/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$ /redir.php?s=$1 [L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /topsites\.php\?k=([^&]+)&r=([^&]+)$
RewriteRule ^/topsites\.php$ [widgetc0.c0m...] [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /redir\.php\?s=([^&]+)$
RewriteRule ^/redir\.php$ [widgetc0.c0m...] [R=301,L]
--------------------000----
my problem is it always says 404 error. aside from that, the parameter "r" on the "topsites.php" is optional so I don't know how I will declare it. these are just two of the php scripts that I need to redirect and rewrite, I'll add the others as soon as I get this thing working.
any help will be highly appreciated.
Thanks in advance.
Comment-out the second two rules until you get the first two working -- They implement a 'luxury' search-engine-results clean-up function that you won't need until you get the first rules working, so keep the file simple until then.
As written, the code must reside in .htaccess in your '/topsites' subdirectory in order for the patterns to match. Otherwise, you'll need to adjust the patterns to suit.
Jim
[widgetc0.c0m...] -- this will throw 404 error
[widgetc0.c0m...] -- this redirects properly
-------------------------------
Options +FollowSymLinks
RewriteEngine on
RewriteRule topsites/k/([^/]+)/([^/]+)/?$ topsites.php?k=$1&r=$2 [L]
RewriteRule redir/s/([^/]+)/?$ /redir.php?s=$1 [L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /topsites\.php\?k=([^&]+)&r=([^&]+)$
RewriteRule ^/topsites\.php$ [widgetc0.c0m...] [R=301,L]
#RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /redir\.php\?s=([^&]+)$
#RewriteRule ^/redir\.php$ [widgetco.c0m...]
-----------------------------
thanks again.
RewriteRule ^topsites/k/([^/]+)/([^/]+)/?$ topsites.php?k=$1&r=$2 [L]
RewriteRule ^topsites/k/([^/]+)/?$ topsites.php?k=$1 [L]
RewriteRule ^topsites/k/([^/]+)(/([^/]+))?/?$ topsites.php?k=$1&r=[b]$3[/b] [L]
Jim