I am on a godaddy server now and trying this mod-rewrite stuff and it is still not working.
I have been searching google now for hours looking for the answer and cannot find it.

Here is my entire .htaccess file:
#Rewrite Rules
Options -MultiViews
Options +FollowSymLinks +Indexes
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)(/?)$ index.php?p=$1 [L]

#RewriteEngine On
#RewriteBase /
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{REQUEST_FILENAME}.php -f
#RewriteRule ^(.+)$ /$1.php [L,QSA]
#RewriteRule ^c/([^/.]+)/?$ index.php?p=$1 [L]


The stuff thats commented out is what I tried the first time, then I tried many many other ways to try and get this to work with no luck.
Thanks,
Brian

Recommended Answers

All 10 Replies

Anyone have any insight on this?

... the weird thing is I got an email saying someone replied to this and I dont see anything.

What do you mean with "is not working"?
Your rule RewriteCond %{REQUEST_FILENAME}.php -f requests that for a request like /abc the file named /abc.php exists. Is that what you want?
Your last rule will never catch anything in its second pair of brackets. In RewriteRule ^(.*)(/?)$ index.php?p=$1 [L] the first bracket pair catches all content.

My goal is to get a domain like this domain.com/training or domain.com/contact instead of domain.com/index.php?p=training.

I have checked numerous sites even a thread on here doing the same exact thing using the same exact example, and i believe he was also using a godaddy server. I used his same code and got nothing, eventually just confused myself because I have used so many different snippets from all over.

Anyone have any insight on this?

... the weird thing is I got an email saying someone replied to this and I dont see anything.

This happened because a spammer replied to your thread, but then a moderator deleted their post.

Try the .htaccess file:

RewriteEngine On
RewriteRule		^([a-z0-9]+).html$		index.php?p=$1	[L]

Then, blah.html will redirect to index.php?p=blah

I have your code in there right now and its still not working. I almost positive that is something I have tried before also.

You can check it out at http://kbrlifestyles.com and just click on a link to see what I am talking about.

ok I see, so I actually need to change the link from "index.php?p=contact" to just "/contact"

This would not happen automatically?

There is nothing in the IT world which happens automatically.
To make the /contact link work, you'll first have to install the modification from my previous post.

Yeah, well it works. thats all that matters to me.

Thanks a bunch!!

Please mark this thread as solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.