Jump to content

Redirecting instead of rewriting.


ejaboneta

Recommended Posts

I've done mod_rewrite a few times before, but this time apache redirects the page instead rewriting as I would expect it to. I'm using a godaddy virtual dedicated server so I have access to apache directly.

 

I do this:

RewriteEngine On
RewriteRule ^([:\+.\)\(a-zA-Z0-9\_-]+)\/([:\+.\)\(a-zA-Z0-9\_-]+)$ http://domain.com/index.php?p=$1/$2 [L]

 

and when I go to url "http://domain.com/page/one", the url changes to "http://domain.com/?p=page/one" instead of staying the clean url. Am I doing something wrong?

Link to comment
Share on other sites

I'd just like to say that after spending a couple hours going through this forum... it's absolutely amazing how many times "how can I change http://mysite.com/index.php?id=343 to look like http://mysite.com/343/page-title?" is asked.... Can we find a good one and sticky it? It's just a little frustrating that I can't find anything relating to my problem... My urls go where they are supposed to but the url is changed back to an unclean url... for example:

 

http://freemedigapquote.com/page/one

Link to comment
Share on other sites

Options +FollowSymLinks +Indexes

RewriteEngine on

RewriteBase /

RewriteRule ^([^.]+)/([^.]+)$ index.php?p=$1/$2 [L]

 

or

 

RewriteRule ^([^.]+)$ index.php?p=$1 [L]

 

if you're going from

 

com/index.php?p=Free-Quote

to

com/Free-Quote

Link to comment
Share on other sites

Yes, that works, but it doesn't solve my problem. I fixed it by adding [P]. For some reason my server defaulted to redirect rather than mask the url... So a user would go to 'com/Free-Quote' but they would be redirected to 'com/index.php?p=Free-Quote'(showing in the address box)...

 

I add the [P] and it works now without redirecting

 

Options +FollowSymLinks +Indexes
RewriteEngine on
RewriteBase /
RewriteRule ^([^.]+)/([^.]+)$ index.php?p=$1/$2 [L,P]

Link to comment
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.