Jump to content

Recommended Posts

how can i rewrite the url seen in the adreess bar. Ive seen it done on youtube where

 

www.youtube.com/inbox?message=1blablabla

 

turns into :

 

www.youtube.com/inbox

 

I have a little bit of code using .htaccess file but im not having any luck with it:

 


Options +FollowSymLinks
RewriteEngine on

RewriteRule ^channel/(.*)/(.*)/recent/(.*) video.php?category=recent&chid=$1&page=$3

 

 

Link to comment
https://forums.phpfreaks.com/topic/132685-how-can-i-rewrite-the-url/
Share on other sites

  • 1 month later...

From my understanding (.*) means the rewrite will accept any type of input (letters, numbers, anything) If you just want letters off the top of my head I think it is ([a-z][A-Z]) but I might be wrong.

 

If you just want index.php to be rewritten to index/ it would be

RewriteRule ^index$ /index.php

 

If you want a trailing slash just change ^index$ to ^index/$

 

-Corey

From my understanding (.*) means the rewrite will accept any type of input (letters, numbers, anything) If you just want letters off the top of my head I think it is ([a-z][A-Z]) but I might be wrong.

 

If you just want index.php to be rewritten to index/ it would be

RewriteRule ^index$ /index.php

 

If you want a trailing slash just change ^index$ to ^index/$

 

-Corey

 

Thanks. A simple example is all i needed :)

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.