eberswine
eberswine

Reputation: 1224

htaccess rewrite w/ godaddy

trying my .htaccess page to rewrite this url

www.mywebsite.com/view.php?2012/this-is-page.html

to

www.mywebsite.com/view.php/2012/this-is-page.html

Where "view.php" is the template... I just don't like the "view.php?"

Finally got this CMS to work using the "?" after "view.php" instead of "/" -- now, how do I get it to rewrite this in the browser URL window ?

So far, I have:

#Fix Rewrite
Options -Multiviews

RewriteEngine on

Upvotes: 1

Views: 172

Answers (1)

anubhava
anubhava

Reputation: 785621

Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

# external redirect from view.php?2012/this-is-page.html to view/2012/this-is-page.html
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+view\.php\?([^\s]+) [NC]
RewriteCond ^ view/%1? [L,R]

# internal forward from view/2012/this-is-page.html to view.php?2012/this-is-page.html
RewriteCond ^view/(.+)$ view.php?$1 [L,NC,QSA]

Upvotes: 2

Related Questions