Jump to content

htaccess file rewrite question


redbrad0

Recommended Posts

I have a .htaccess file that is very small and simple. Everything works fine with this. So if I goto http://www.domain.com/wikiNew/ it actually loads the wiki_live data. Now the only problem is before I added in this htaccess file are url's used to be all screwed up and looked like this

 

Old: http://www.domain.com/wikiNew//index.php/Something/AndSomething/

New: http://www.domain.com/wikiNew/Something/AndSomething/

 

So in the htaccess file how can I add in a rewrite that will direct anything at wikiNew//index.php/??? to wikiNew/???

 

Current htaccess file

RewriteEngine On
#RewriteBase /~username
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^wikiNew/(.*) wiki_live/index.php?title=$1 [PT,L,QSA]
RewriteRule ^wikiNew/*$ wikiNew/ [L,QSA]
RewriteRule ^/*$ wikiNew/ [L,QSA]

Link to comment
Share on other sites

I would actually send anything to wikiNew/index.php to a file and in that file send a 301 redirect header and than redirect them to the new properly formatted URL. It will be easier to just use PHP for the redirect portion if you ask me.

Link to comment
Share on other sites

I agree and I would rather it goto its own php file so I can display to the end user they need to update their bookmarks. This is not a external site, so I am not worried about search engines or anything else. Basically I just want the employees that have url's bookmarked to get a message that the bookmark needs to be updated. Just as a test to send the user to a correct url, I have tried the following line in the .htaccess file on the root of the site but it does not seem to redirect the user. Any ideas what I can try?

 

RewriteRule ^wikiNew//index.php/(.*)/(.*)/ wikiNew/$1/$2/ [PT,L,QSA]
RewriteRule ^wikiNew//index.php/(.*)/ wikiNew/$1/ [PT,L,QSA]

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.