Jump to content

Recommended Posts

Thats a good idea, however; my entire website is a 3 column layout with the middle changing through locate. The rest remains static PLUS I've just realised I'll need 33 in total changes!

 

I read an article and came up with this:

 

RewriteEngine On

RewriteRule ^register$ index.php?locate=register

 

Not sure where or what to save the .htaccess file as

Link to comment
https://forums.phpfreaks.com/topic/69348-re-route/#findComment-348452
Share on other sites

This will work in your root directory, directing everything to index.php, adding the request to the 'local'. e.g. if you called 'www.mywebsite.com/register' it would really call 'www.mywebsite.com/index.php?local=register':

 

RewriteEngine on
Options +FollowSymlinks
RewriteBase /

RewriteRule ^([^/]+)/?$ index.php?local=$1 [QSA,L]		#	files in home dir only

Link to comment
https://forums.phpfreaks.com/topic/69348-re-route/#findComment-348455
Share on other sites

You can have a .htaccess file in each directory. Basically it's a per directory directives for your server. Make sure your server has this functionality turned on. The dot (.) in front of the file means it hidden (on unix), just save it as a text file (no extension, just named as '.htaccess')

Link to comment
https://forums.phpfreaks.com/topic/69348-re-route/#findComment-348459
Share on other sites

Hey phat_hip_prog,

thanks for your help buddy. I tried this:

RewriteEngine On

RewriteRule ^register$ index.php?locate=register

 

Saved this as .htaccess in the same directory as index.php and it worked.

 

I don't really get your code:

RewriteEngine on

Options +FollowSymlinks

RewriteBase /

 

RewriteRule ^([^/]+)/?$ index.php?local=$1 [QSA,L] # files in home dir only

 

although I see what you're saying about saving in each directory.

Link to comment
https://forums.phpfreaks.com/topic/69348-re-route/#findComment-348466
Share on other sites

You 'can' have one in every/any directory, there's lot's more you can do with them like password protect, custom error pages, etc...

 

You'll get some info here, .htaccess files use same directives as the apache conf file:

http://httpd.apache.org/docs/2.2/howto/htaccess.html

http://httpd.apache.org/docs/2.2/configuring.html

Link to comment
https://forums.phpfreaks.com/topic/69348-re-route/#findComment-348470
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.