Jump to content

Nice urls not working.


r0b

Recommended Posts

I'm currently using

Options +FollowSymLinks
Options +Indexes
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^\.]+)$ $1.php [NC,L]

 

for changing urls from example.com/pagename.php to example.com/pagename

I recently finished a CMS which has uses urls like example.com/?page=Pagename

 

Could anyone help me with the htaccess code for chaning the example.com/?page=Pagename to just example.com/pagename

 

Would something like this work?

Options +FollowSymLinks
Options +Indexes
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^\.]+)$ ?page=$1.php [NC,L]

 

Link to comment
https://forums.phpfreaks.com/topic/236299-nice-urls-not-working/
Share on other sites

Seconds later I just think I figured it out, this works, is the code okay?

 

Options +FollowSymLinks
Options +Indexes
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^\.]+)$ ?page=$1 [NC,L]

 

And am is this a valid looking htaccess file? (posting the whole htaccess)

# more password protection
<Files password>
order allow,deny
deny from all
</Files>

Options +FollowSymLinks
Options +Indexes
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^\.]+)$ ?page=$1 [NC,L]

The code works just fine, its causing one problem:

 

When logging into the admin panel from a page for example

 

example.com/Home trying to login to the administration panel to example.com/?login

the link becomes example.com/Home?login.

 

This problem doesn't occur if I login directly to the admin panel from example.com

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.