2 Replies - 1857 Views - Last Post: 06 March 2012 - 01:37 AM

#1 mccabec123  Icon User is offline

  • D.I.C Head

Reputation: 18
  • View blog
  • Posts: 233
  • Joined: 03-March 11

MOD_REWRITE for rewriting GET requests

Posted 27 February 2012 - 05:59 AM

Hello everyone, I was wondering if anybody could give me something that I could write in the .htaccess file on my server to get it to rewrite the URL from this:

http://************.com/?pageName=FourthPage

To this:

http://global7voices....com/FourthPage

Whilst retaining the GET request variables and information?

I've been researching and researching, and nothing seems to work, I don't know if it's anything to do with the fact that the server is using LiteSpeed instead of Apache, but if any of you guys have any ideas on how to get this to work, that would be incredibly helpful.

Thanks a lot guys.

Is This A Good Question/Topic? 0
  • +

Replies To: MOD_REWRITE for rewriting GET requests

#2 KingCuddles  Icon User is offline

  • D.I.C Regular

Reputation: 176
  • View blog
  • Posts: 496
  • Joined: 20-December 08

Re: MOD_REWRITE for rewriting GET requests

Posted 02 March 2012 - 06:31 AM

Have you had a quick go at trying this, it should be extremely easy...

RewriteCond %{REQUEST_fileNAME} !-d
RewriteCond %{REQUEST_fileNAME} !-f
RewriteRule ^([^/\.]+)/?$ index.php?pageName=$1



This is untested but should help get you started, index.php will be what ever page accepts your $_GET['pageName'] variable.

You could also do.

RewriteRule ^page/([^/\.]+)/?$ index.php?pageName=$1



Then you could have www.example.com/page/FourthPage.
Was This Post Helpful? 1
  • +
  • -

#3 mccabec123  Icon User is offline

  • D.I.C Head

Reputation: 18
  • View blog
  • Posts: 233
  • Joined: 03-March 11

Re: MOD_REWRITE for rewriting GET requests

Posted 06 March 2012 - 01:37 AM

Thanks dude, that helped a lot. I had another way implemented, but it wasn't so good for accessing real directories. Made my day :D

I've never really used .htaccess for this purpose before, that's why I needed the help, thank you!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1