MyBB Community Forums
HTACCESS rewrite help - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Community (https://community.mybb.com/forum-12.html)
+--- Forum: General Discussion (https://community.mybb.com/forum-11.html)
+---- Forum: Web Development and Administration (https://community.mybb.com/forum-133.html)
+---- Thread: HTACCESS rewrite help (/thread-100523.html)



HTACCESS rewrite help - Paul H. - 2011-08-02

How can you rewrite any url like so?

http://example.com/fooey >> http://example.com/define.php?w=fooey

EDIT: So that when some one goes to the first link they are sent to the second.


RE: HTACCESS rewrite help - Omar G. - 2011-08-02

Add this to your .htaccess file:
RewriteEngine On
RewriteRule ^([^/]*)$ /define.php?w=$1 [L]

So http://example.com/define.php?w=fooey will be accesible from http://example.com/fooey

I don't know if the url can be forced to cahnge (like forcing http://example.com/fooey when accessing http://example.com/define.php?w=fooey).

http://www.generateit.net/mod-rewrite/


RE: HTACCESS rewrite help - Paul H. - 2011-08-02

Thanks!