0

I'm new to this, please have grace...

So I understand changing the .htaccess file to let users type in a new link, and then it reference the old page as seen here:
I want to access 127.0.0.1/site/result.php?par1=var1&par2=var2&par3=var3, by typing in 127.0.0.1/site/var1-var2-var3.html

.htaccess file:
Options +FollowSymLinks
RewriteEngine On

RewriteRule ^(.*)_(.*)_(.*)\.html$ result.php?var1=$1&var2=$2&var3=$3


it works... but now, how do I automatically when I submit the form, get the new link to display? Or in other words, how do when we type in 127.0.0.1/site/result.php?par1=var1&par2=var2&par3=var3 be redirected to 127.0.0.1/site/var1-var2-var3.html?

Any help would be appreciated!

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by santclasi
0

You have to send the 301 redirect code explicitly as a flag
These flags go in brackets after your RewriteRule. In your case you could try this:

RewriteRule ^(.*)_(.*)_(.*)\.html$ result.php?var1=$1&var2=$2&var3=$3 [R=301, L]

R=301 says "send the 301 permanent redirect"
the L flag says that this is the last flag for this command.

Here is a random googled page for RewriteRule flags:
http://www.htaccesselite.com/mod-rewrite-flags-vt101.html

Good luck!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.