Jump to content

.htaccess URL Rewrite for index.php


Jamie

Recommended Posts

Hi guys,

I've been trying to get this to work now for a while, so I thought that someone here may be able to help me.

I'm trying to make the URL rewrite work so that I can remove index.php from phpVMS.

I've already been trying myself so the URL Rewrite function in phpVMS is already set to true, I really would like to be able to remove the index.php so if anyone has done this before and can help me it would be much appreciated.

Regards

Jamie

Link to comment
Share on other sites

  • Moderators

With out modding all the code i dont think you can, its been hardcoded in. Nabeel will be able to reply better to this.

Yeah I tried that and it gave me the errors.

Otherwise I would like to see that in php VMS.

Link to comment
Share on other sites

  • Administrators

This ends up need a few changes with how URLs are handled, so it will be available on the next version for sure.

I'm testing to see if an updated version of just the CodonRewrite class will help, so you can have it for current releases, at leas, by just updating that file, and an htaccess

Everything uses the url() function in bootstrap.php, so the fix ends up being pretty simple, but that doesn't even need changing.

Link to comment
Share on other sites

  • Moderators

This ends up need a few changes with how URLs are handled, so it will be avail on the next version for sure.

I'm testing to see if an updated version of just the CodonRewrite class will help, so you can have it for current releases, at least

Awsome to hear Nabeel.

So how is it done? Is it like that.......

http://yourva.com/index.php/profile

into

http://yourva.com/profile

Is that right if not, can you clear it up please. Thanks. :D

Link to comment
Share on other sites

  • Administrators

Yeap, that would be it. Infact, you can test it real quick, see if it works...

Place into /core/classes:

https://github.com/nshahzad/phpVMS/raw/master/core/classes/CodonRewrite.class.php

Then in the root (next to index.php), place in a .htaccess file:

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1  [L]

See if that works. I can't edit the CodonRewrite file due to a permissions error, and he hasn't gotten back to me yet.

  • Like 1
Link to comment
Share on other sites

  • Administrators

Can you try this full htaccess:


Options +FollowSymLinks
Options All -Indexes 

# Rewrite Rules
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1  [L]

<FilesMatch "\.(htaccess|htpasswd|ini|phps|fla|psd|log|sh|tpl)$">
Order Allow,Deny
Deny from all
</FilesMatch>

Try getting to a .tpl file as well

THanks

Link to comment
Share on other sites

  • Moderators

Oh, Mine's the same.

It's does work with no problems.

# main page of the site
DirectoryIndex index.php

# prevent viewing of a specific file
<FilesMatch "\.(htaccess|htpasswd|ini|phps|fla|psd|log|sh|tpl)$">
Order Allow,Deny
Deny from all
</FilesMatch>

# prevent viewing of index
Options -Indexes

#Can give without index.php for the modules
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1  [L]

Link to comment
Share on other sites

  • Administrators

No worries i sorted it ;)

Nabeel, did you manage to get rid of that fs pax message about no aircraft entered?

Can you create a bug for that? Otherwise I wont remember.

Just a warning to all, there are still some issues with this rewrite thing, I have to sort them out soon

Link to comment
Share on other sites

  • 1 year later...
  • 3 weeks later...
  • 1 month later...
  • 2 months later...

ok this gives me the modules too

except the Acars map data does not show up any idea help needed!

# main page of the site
DirectoryIndex index.php
# prevent viewing of a specific file
<FilesMatch "\.(htaccess|htpasswd|ini|phps|fla|psd|log|sh|tpl)$">
Order Allow,Deny
Deny from all
</FilesMatch>
# prevent viewing of index
Options +FollowSymLinks
Options All -Indexes

#Can give without index.php for the modules
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1  [L]

Link to comment
Share on other sites

  • 2 months later...
  • 1 month later...

I'm having a similar problem... The .htaccess is configured and URL_REWRITE e set to true. I can atually print_r the q= coming from .htaccess, but wherever I click, it only shows the homepage.

I was having that too. I fixed it by using the CondonRewrite.class.php of David Clark's extended version on Nabeel's full version downloadable here in phpvms.net and this .htaccess. It works 100% for me now.

# main page of the site

DirectoryIndex index.php

# prevent viewing of a specific file

<FilesMatch "\.(htaccess|htpasswd|ini|phps|fla|psd|log|sh|tpl)$">

Order Allow,Deny

Deny from all

</FilesMatch>

# prevent viewing of index

Options +FollowSymLinks

Options All -Indexes

#Can give without index.php for the modules

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php?q=$1 [L]

Link to comment
Share on other sites

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.

Loading...
×
×
  • Create New...