Hello everybody. My question is this my magazine is hosted at the following URL
http://asaeca.org/imagofagia/index.php/imagofagia. I wanted a simpler url that looks like this
http://asaeca.org/imagofagia
is this possible? someone tried it? can you help me?
thank you very much for the excellent software!
See the config.inc.php setting ārestful_urlsā.
thank you very much!
This isnāt working on my setupā¦
Our server is using sites-enabled configuration.
Where should I put the rewrite code:
-
Inside
<Directory>
OR -
Inside
<VirtualHost>
How do I make sure mod_rewrite is enabled??
The index.php gets removed, but I get a 404 page when accessing individual journalsā¦ Do I also need to setup individual journal addresses? I added the journal path within [] and the URL as a full address, such as http://myserver.com/myjournal
Is this correct??
To confirm that mod_write is installed, run apachectl -M
to list the current modules and look for ārewrite_moduleā in the list. It should be referenced via a LoadModule
directive (probably in httpd.conf), and then activated by a RewriteEngine on
directive (usually as needed).
See the mod_rewrite documentation for allowed positioning of the directives. For example, RewriteEngine
can be used in server config, virtual host, directory, or .htaccess
If your index.php path is being removed, mod_rewrite is probably installed, enabled, and active. The 404 probably indicates that the RewriteRule in incorrect.
The general strategy is RewriteRule pathYouWantTheUserToSee pathWhereTheFileReallyIs [Options]
Where have you installed OJS, and where have you placed the RewriteRule?
Hello @ctgraham,
I didnāt find a rewrite module loaded on the list.
OJS is installed at Web serverās root, as itās an exclusive virtual machine, at /var/www/myojsfoldername.
The last version of the rules are within the /etc/apache/sites-enabled/enabled-sites config file, within the tags, after all the other rulesā¦(commented out as they didnāt work). I got those from an old post at the previous forum.
# RewriteEngine on
#
# RewriteCond %{REQUEST_FILENAME} !-d
# RewriteCond %{REQUEST_FILENAME} !-f
# RewriteRule ^ciinf(.*)$ /index.php/ciinf$1 [QSA,L]
#
# RewriteCond %{REQUEST_FILENAME} !-d
# RewriteCond %{REQUEST_FILENAME} !-f
# RewriteRule ^(.*)$ index.php/$1 [QSA,L]
# </IfModule>
Hereās the list of loaded modules, from the apachectl -M command:
Loaded Modules:
core_module (static)
log_config_module (static)
logio_module (static)
version_module (static)
mpm_prefork_module (static)
http_module (static)
so_module (static)
alias_module (shared)
auth_basic_module (shared)
authn_file_module (shared)
authz_default_module (shared)
authz_groupfile_module (shared)
authz_host_module (shared)
authz_user_module (shared)
autoindex_module (shared)
cgi_module (shared)
deflate_module (shared)
dir_module (shared)
env_module (shared)
mime_module (shared)
negotiation_module (shared)
php5_module (shared)
reqtimeout_module (shared)
setenvif_module (shared)
status_module (shared)
You will need to install and enable the mod_rewrite module as the next step. Check with your system administrator (if hosted) or with your Linux documentation (if running your own server).
Hello @ctgraham,
Support installed and enabled mod_rewrite.
It seems to be working now!!
Check it out at http://revista.ibict.br
Iām still importing data from previous versionsā¦
The categories and search pages are not workingā¦
More rules are required?
To completely remove ojs/index.php/journal links do I need to add further rules??
You probably just need a base_url[index]
setting in config.inc.php. It should point to your site index path, which will be āhttp://revista.ibict.br/index/ā
Still not working for journal categories and searchā¦
; The canonical URL to the OJS installation (excluding the trailing slash)
base_url = āhttp://revista.ibict.brā
base_url[index] = http://revista.ibict.br/index
What rewrite directives do you actually have enabled now?
Hi,
Just these onesā¦
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,L]
The syntax %{REQUEST_FILENAME}
is slightly obsolete and should be replaced by %{DOCUMENT_ROOT}%{REQUEST_URI}
for Apache 2.2 or better, which you are probably using. This change wouldnāt explain the the error you are seeing, however.
Out of curiosity, what happens if you use an absolute path for the rewrite?
RewriteEngine on
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} ! -d
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} ! -f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php/$1 [QSA,L]
It displayed an error when trying to stop Apache, that the configuration file failed.
Apache doesnāt restartā¦
What version of Apache are you running?
What error does Apache report when you test the config with the changed rewrite directives?
RewriteCond: bad flag delimiters
Error log shows nothing usefulā¦
Just so you know, its Apache 2.2.22 (Debian).
[UPDATE]
Since this is in sites-enabled/available file, shouldnāt there be something to let the mod_rewrite rule where to work from? Iām not sure if DOCUMENT_ROOT is enough in this case. Weāre not using a .HTACCESS file
NOTE:
If I canāt get this to work by today, Iāll have to go without mod_rewriteā¦ I have to launch this next week.
Hello all,
Figured out there were spaces before the -d and -f commands in some commands. The %{DOCUMENT_ROOT}%{REQUEST_URI} didnāt work.
These worked:
RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ciinf(.*)$ /index.php/ciinf$1 [L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^inclusao(.*)$ /index.php/inclusao$1 [L]
Need to add one block for each journalā¦
Hi,
This should work as well and avoids repeating yourself:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(ciinf|inclusao|any_other|journalname)(.*)$ /index.php/$1$2 [L]
I see that you are not using the QSA
(query string append) option of RewriteRule
that @ctgraham orignally suggested. Is this intentional?
Greetings
Hermann
I think the QSA modifier in the documentation is also an unnecessary holdover from a past usage. Thereās no query string in the rewrite rule, so I donāt think QSA should have any effect.
Hello @hermann,
This prevents the search/categories from workingā¦
[UPDATE]
After messing with what was working, now, it isnāt workingā¦ againā¦
This is what is on sites-enabled:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php/$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ciinf(.*)$ /index.php/ciinf$1 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^cienciadainformacao(.*)$ /index.php/ciinf$1 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^inclusao(.*)$ /index.php/inclusao$1 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^fiinf(.*)$ /index.php/fiinf$1 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^p2p(.*)$ /index.php/p2p$1 [L]
This is whatās in config.inc.php
base_url[index] = http://revista.ibict.br
base_url[ciinf] = http://revista.ibict.br/ciinf
base_url[cienciadainformacao] = http://revista.ibict.br/ciinf
base_url[inclusao] = http://revista.ibict.br/inclusao
base_url[fiinf] = http://revista.ibict.br/fiinf
base_url[p2p] = http://revista.ibict.br/p2p
the cienciadainformacao is an old address Iād like to keepā¦ Not sure if itāll work for every link, but it will get them to the journal somehow.